netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Prarit Bhargava <prarit@redhat.com>
To: David Laight <David.Laight@ACULAB.COM>
Cc: Jack Morgenstein <jackm@dev.mellanox.co.il>,
	Or Gerlitz <or.gerlitz@gmail.com>,
	netdev@vger.kernel.org, Doug Ledford <dledford@redhat.com>,
	Amir Vadai <amirv@mellanox.com>,
	Or Gerlitz <ogerlitz@mellanox.com>
Subject: Re: [PATCH] net, mellanox mlx4 Fix compile warnings
Date: Mon, 16 Sep 2013 08:14:50 -0400	[thread overview]
Message-ID: <5236F63A.9000202@redhat.com> (raw)
In-Reply-To: <AE90C24D6B3A694183C094C60CF0A2F6026B733A@saturn3.aculab.com>



On 09/16/2013 04:59 AM, David Laight wrote:
>> On Sat, 14 Sep 2013 22:10:19 +0300
>> Or Gerlitz <or.gerlitz@gmail.com> wrote:
>>
>>>> +       struct res_cq *uninitialized_var(cq);
>>>>
>>>>         err = cq_res_start_move_to(dev, slave, cqn,
>>>> RES_CQ_ALLOCATED, &cq);
>>
>> I have no objection. However, I don't know if the compiler is being too
>> clever here or too stupid.  The cq variable is initialized in
>> cq_res_start_move_to(), but the compiler is ignoring this -- or maybe
>> it is simply not assuming that cq will in fact be
>> initialized by the called procedure?
> 
> Possibly cq_res_start_move_to() got inlined - and the analysis
> of the inlined code found a path where it wasn't initialised.
> 
> Most likely one of the paths where the return value is non-zero.
> 
>> In any event, this change cannot hurt.
> 
> It could hide a real 'used but not initialised' error later on...

Hi David,

I certainly don't profess to know the code better than you do of course, but in
terms of risk we're no better in than the original code here, and it seems that
other places in the kernel the resolution has been to either init to NULL or
wrap with uninitialized_var()...

P.

  reply	other threads:[~2013-09-16 12:15 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-13 12:30 [PATCH] net, mellanox mlx4 Fix compile warnings Prarit Bhargava
2013-09-14 19:10 ` Or Gerlitz
2013-09-15  6:14   ` Jack Morgenstein
2013-09-15  6:22     ` ZHAO Gang
2013-09-15  6:27       ` ZHAO Gang
2013-09-16  8:59     ` David Laight
2013-09-16 12:14       ` Prarit Bhargava [this message]
2013-09-16 13:52       ` Jack Morgenstein
2013-09-17  1:25 ` David Miller
2013-09-17 19:13   ` [PATCH 2/2] " Prarit Bhargava
2013-09-17 19:25     ` Or Gerlitz
2013-09-17 19:28       ` 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=5236F63A.9000202@redhat.com \
    --to=prarit@redhat.com \
    --cc=David.Laight@ACULAB.COM \
    --cc=amirv@mellanox.com \
    --cc=dledford@redhat.com \
    --cc=jackm@dev.mellanox.co.il \
    --cc=netdev@vger.kernel.org \
    --cc=ogerlitz@mellanox.com \
    --cc=or.gerlitz@gmail.com \
    /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).