linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Yuval Mintz <Yuval.Mintz@qlogic.com>
To: Arnd Bergmann <arnd@arndb.de>, David Miller <davem@davemloft.net>
Cc: Manish Chopra <manish.chopra@qlogic.com>,
	Sudarsana Kalluru <Sudarsana.Kalluru@qlogic.com>,
	netdev <netdev@vger.kernel.org>,
	linux-kernel <linux-kernel@vger.kernel.org>,
	Ariel Elior <Ariel.Elior@qlogic.com>
Subject: RE: [PATCH v2] qed: fix qed_fill_link() error handling
Date: Wed, 1 Jun 2016 13:36:38 +0000	[thread overview]
Message-ID: <CO2PR11MB0088CD4139A272FEB3947EF897470@CO2PR11MB0088.namprd11.prod.outlook.com> (raw)
In-Reply-To: <11393820.LSE4DkNrNd@wuerfel>

> 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>

  reply	other threads:[~2016-06-01 13:36 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-30 15:46 [PATCH] qed: fix qed_fill_link() error handling Arnd Bergmann
2016-05-30 16:24 ` Yuval Mintz
2016-05-31 21:20   ` David Miller
2016-05-31 22:34     ` Arnd Bergmann
2016-06-01 10:55       ` Yuval Mintz
2016-06-01 11:03         ` Arnd Bergmann
2016-06-01 11:10           ` Yuval Mintz
2016-06-01 13:29             ` [PATCH v2] " Arnd Bergmann
2016-06-01 13:36               ` Yuval Mintz [this message]
2016-06-02  5:06                 ` David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CO2PR11MB0088CD4139A272FEB3947EF897470@CO2PR11MB0088.namprd11.prod.outlook.com \
    --to=yuval.mintz@qlogic.com \
    --cc=Ariel.Elior@qlogic.com \
    --cc=Sudarsana.Kalluru@qlogic.com \
    --cc=arnd@arndb.de \
    --cc=davem@davemloft.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=manish.chopra@qlogic.com \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).