linux/drivers/net/ethernet/qlogic/qed
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
..
Makefile qed: add support for dcbx. 2016-05-17 12:29:34 -04:00
qed.h qed: add support for dcbx. 2016-05-17 12:29:34 -04:00
qed_cxt.c qed: Introduce VFs 2016-05-12 00:04:07 -04:00
qed_cxt.h qed: add support for dcbx. 2016-05-17 12:29:34 -04:00
qed_dcbx.c qed: Reset the enable flag for eth protocol. 2016-05-25 12:32:41 -07:00
qed_dcbx.h qed: add support for dcbx. 2016-05-17 12:29:34 -04:00
qed_dev.c qed: Don't config min BW on 100g on link flap 2016-05-26 12:27:33 -07:00
qed_dev_api.h qed: IOV configure and FLR 2016-05-12 00:04:07 -04:00
qed_hsi.h qed: add support for dcbx. 2016-05-17 12:29:34 -04:00
qed_hw.c qed: Introduce VFs 2016-05-12 00:04:07 -04:00
qed_hw.h qed: Add CONFIG_QED_SRIOV 2016-05-12 00:04:06 -04:00
qed_init_fw_funcs.c qed: Add PF min bandwidth configuration support 2016-04-26 13:56:26 -04:00
qed_init_ops.c qed: Introduce VFs 2016-05-12 00:04:07 -04:00
qed_init_ops.h
qed_int.c qed: Improve VF interrupt reset 2016-05-16 13:59:18 -04:00
qed_int.h qed: Improve VF interrupt reset 2016-05-16 13:59:18 -04:00
qed_l2.c qed*: Tx-switching configuration 2016-05-12 00:04:08 -04:00
qed_l2.h qed*: Tx-switching configuration 2016-05-12 00:04:08 -04:00
qed_main.c qed: fix qed_fill_link() error handling 2016-06-01 22:04:54 -07:00
qed_mcp.c qed: add support for dcbx. 2016-05-17 12:29:34 -04:00
qed_mcp.h qed: IOV configure and FLR 2016-05-12 00:04:07 -04:00
qed_reg_addr.h qed: Improve VF interrupt reset 2016-05-16 13:59:18 -04:00
qed_selftest.c qed: add infrastructure for device self tests. 2016-05-02 00:16:39 -04:00
qed_selftest.h qed: add infrastructure for device self tests. 2016-05-02 00:16:39 -04:00
qed_sp.h qed: add support for dcbx. 2016-05-17 12:29:34 -04:00
qed_sp_commands.c qed: add support for dcbx. 2016-05-17 12:29:34 -04:00
qed_spq.c qed: Introduce VFs 2016-05-12 00:04:07 -04:00
qed_sriov.c qed: Allow more than 16 VFs 2016-05-16 13:59:19 -04:00
qed_sriov.h qed: fix qed_fill_link() error handling 2016-06-01 22:04:54 -07:00
qed_vf.c qed*: Tx-switching configuration 2016-05-12 00:04:08 -04:00
qed_vf.h qed*: Support forced MAC 2016-05-12 00:04:08 -04:00