Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1411227
| From | Yuval Mintz <Yuval.Mintz@qlogic.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | RE: [PATCH v2] qed: fix qed_fill_link() error handling |
| Date | 2016-06-01 15:40 +0200 |
| Message-ID | <rFexj-yn-15@gated-at.bofh.it> (permalink) |
| References | <rExC2-67g-5@gated-at.bofh.it> <rFcc9-7Eu-7@gated-at.bofh.it> <rFclQ-7HG-15@gated-at.bofh.it> <rFenE-uk-29@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
> 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> > > --- > On Wednesday, June 1, 2016 11:10:30 AM CEST Yuval Mintz wrote: > > Actually, I think VF probe should gracefully fail in that case, as > > qed_vf_hw_prepare() would simply return -EINVAL. > > But I can honestly say I've never tested this flow, and I agree > > there's no reason to allow VF probe in case we're not supporting SRIOV. > > ok > > > So I guess removing the PCI ID and defining IS_PF to be true in case > > CONFIG_QED_SRIOV isn't set is the right way to go. > > Do you want to revise your patch, or do you want me to do it? > > I've done the patch below now, please either Ack or modify it the way you like > and forward it. > > Thanks, > > Arnd Perhaps it would have made more sense as a 2-part series; But I'm content with the changes themselves. I'd let Dave decide whether he wants it split. Thanks for taking the time fixing this. Acked-by: Yuval Mintz <Yuval.Mintz@qlogic.com>
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Re: [PATCH] qed: fix qed_fill_link() error handling David Miller <davem@davemloft.net> - 2016-05-31 23:30 +0200
Re: [PATCH] qed: fix qed_fill_link() error handling Arnd Bergmann <arnd@arndb.de> - 2016-06-01 00:40 +0200
RE: [PATCH] qed: fix qed_fill_link() error handling Yuval Mintz <Yuval.Mintz@qlogic.com> - 2016-06-01 13:00 +0200
Re: [PATCH] qed: fix qed_fill_link() error handling Arnd Bergmann <arnd@arndb.de> - 2016-06-01 13:10 +0200
RE: [PATCH] qed: fix qed_fill_link() error handling Yuval Mintz <Yuval.Mintz@qlogic.com> - 2016-06-01 13:20 +0200
[PATCH v2] qed: fix qed_fill_link() error handling Arnd Bergmann <arnd@arndb.de> - 2016-06-01 15:30 +0200
RE: [PATCH v2] qed: fix qed_fill_link() error handling Yuval Mintz <Yuval.Mintz@qlogic.com> - 2016-06-01 15:40 +0200
Re: [PATCH v2] qed: fix qed_fill_link() error handling David Miller <davem@davemloft.net> - 2016-06-02 07:10 +0200
csiph-web