bnx2fc: reduce stack usage in __bnx2fc_enable
authorArnd Bergmann <arnd@arndb.de>
Wed, 7 Oct 2015 13:11:04 +0000 (15:11 +0200)
committerJames Bottomley <JBottomley@Odin.com>
Tue, 10 Nov 2015 01:10:24 +0000 (17:10 -0800)
commit720ba808e9ca276919f566bbe2b4e09c79f25faa
treeded0205bbdc7e55b5debaa10e4461e4a1ed1ea64
parente79504236548e4c909959ba444f87a12224555ac
bnx2fc: reduce stack usage in __bnx2fc_enable

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: Arnd Bergmann <arnd@arndb.de>
Fixes: 2971ff67bd3 ("bnx2fc: Read npiv table from nvram and create vports.")
Acked-by: Chad Dupuis <chad.dupuis@qlogic.com>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
drivers/scsi/bnx2fc/bnx2fc_fcoe.c