• Arnd Bergmann's avatar
    bnx2fc: reduce stack usage in __bnx2fc_enable · 720ba808
    Arnd Bergmann authored
    When the bnx2fc driver was changed to read the npiv table from
    nvram, the stack of the __bnx2fc_enable function gained an
    additional 1028 byte structure that gcc rightfully warns about:
    
    drivers/scsi/bnx2fc/bnx2fc_fcoe.c: In function '__bnx2fc_enable':
    drivers/scsi/bnx2fc/bnx2fc_fcoe.c:2134:1: warning: the frame size of 1128 bytes is larger than 1024 bytes [-Wframe-larger-than=]
    
    In order to avoid a possible kernel stack overflow and to get rid
    of the warning, this changes the function to use a dynamic allocation
    of the structure using kzalloc.
    Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
    Fixes: 2971ff67 ("bnx2fc: Read npiv table from nvram and create vports.")
    Acked-by: default avatarChad Dupuis <chad.dupuis@qlogic.com>
    Signed-off-by: default avatarJames Bottomley <JBottomley@Odin.com>
    720ba808
bnx2fc_fcoe.c 73.5 KB