linux/drivers/net/ethernet/qlogic
Arnd Bergmann 14b84e8654 qed: fix qed_fill_link() error handling
gcc warns about qed_fill_link possibly accessing uninitialized data:

drivers/net/ethernet/qlogic/qed/qed_main.c: In function 'qed_fill_link':
drivers/net/ethernet/qlogic/qed/qed_main.c:1170:35: error: 'link_caps' may be used uninitialized in this function [-Werror=maybe-uninitialized]

While this warning is only about the specific case of CONFIG_QED_SRIOV
being disabled but the function getting called for a VF (which should
never happen), another possibility is that qed_mcp_get_*() fails without
returning data.

This rearranges the code so we bail out in either of the two cases
and print a warning instead of accessing the uninitialized data.

The qed_link_output structure remains untouched in this case, but
all callers first call memset() on it, so at least we are not leaking
stack data then.

As discussed, we also use a compile-time check to ensure we never
use any of the VF code if CONFIG_QED_SRIOV is disabled, and the
PCI device table is updated to no longer bind to virtual functions
in that configuration.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Yuval Mintz <Yuval.Mintz@qlogic.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2016-06-01 22:04:54 -07:00
..
netxen Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2016-05-09 15:59:24 -04:00
qed qed: fix qed_fill_link() error handling 2016-06-01 22:04:54 -07:00
qede qed: fix qed_fill_link() error handling 2016-06-01 22:04:54 -07:00
qlcnic Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2016-05-15 13:32:48 -04:00
qlge net/qlge: Avoids recursive EEH error 2016-05-24 14:47:19 -07:00
Kconfig qed: Add CONFIG_QED_SRIOV 2016-05-12 00:04:06 -04:00
Makefile qede: Add basic Network driver 2015-10-27 19:34:47 -07:00
qla3xxx.c drivers/net: get rid of unnecessary initializations in .get_drvinfo() 2015-10-16 00:24:10 -07:00
qla3xxx.h