]> www.infradead.org Git - users/jedix/linux-maple.git/commit
qed: fix qed_fill_link() error handling
authorArnd Bergmann <arnd@arndb.de>
Wed, 1 Jun 2016 13:29:13 +0000 (15:29 +0200)
committerChuck Anderson <chuck.anderson@oracle.com>
Fri, 8 Jul 2016 19:29:57 +0000 (12:29 -0700)
commit21ac5c031072b38e04904457403f00201701c6b9
treeba61250356e2fbe565773b85db9f3ed60de6aa41
parent138c1c13e17139cb81bef4e3b55b25a137b8af03
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>
Orabug: 23732603
Signed-off-by: Manjunath Govindashetty <manjunath.govindashetty@oracle.com>
drivers/net/ethernet/qlogic/qed/qed_main.c
drivers/net/ethernet/qlogic/qed/qed_sriov.h
drivers/net/ethernet/qlogic/qede/qede_main.c