From: Greg Thelen <gthelen@google.com>
To: Leon Romanovsky <leon@kernel.org>
Cc: Or Gerlitz <ogerlitz@mellanox.com>,
Jack Morgenstein <jackm@dev.mellanox.co.il>,
Matan Barak <matanb@mellanox.com>, Ido Shamay <idos@mellanox.com>,
Yishai Hadas <yishaih@mellanox.com>,
Amir Vadai <amirv@mellanox.com>,
Roland Dreier <roland@purestorage.com>,
"David S. Miller" <davem@davemloft.net>,
netdev@vger.kernel.org, linux-rdma@vger.kernel.org,
linux-kernel@vger.kernel.org, Tariq Toukan <tariqt@mellanox.com>
Subject: Re: [PATCH] net/mlx4: suppress 'may be used uninitialized' warning
Date: Tue, 18 Apr 2017 00:24:05 -0700 [thread overview]
Message-ID: <xr93tw5m18mi.fsf@gthelen.mtv.corp.google.com> (raw)
In-Reply-To: <20170418070219.GA14088@mtr-leonro.local>
Leon Romanovsky <leon@kernel.org> wrote:
> [ Unknown signature status ]
> On Mon, Apr 17, 2017 at 11:21:35PM -0700, Greg Thelen wrote:
>> gcc 4.8.4 complains that mlx4_SW2HW_MPT_wrapper() uses an uninitialized
>> 'mpt' variable:
>> drivers/net/ethernet/mellanox/mlx4/resource_tracker.c: In function 'mlx4_SW2HW_MPT_wrapper':
>> drivers/net/ethernet/mellanox/mlx4/resource_tracker.c:2802:12: warning: 'mpt' may be used uninitialized in this function [-Wmaybe-uninitialized]
>> mpt->mtt = mtt;
>>
>> I think this warning is a false complaint. mpt is only used when
>> mr_res_start_move_to() return zero, and in all such cases it initializes
>> mpt.
>> But apparently gcc cannot see that.
>>
>> Initialize mpt to avoid the warning.
>>
>> Signed-off-by: Greg Thelen <gthelen@google.com>
>> ---
>
> It looks like other callers of mr_res_start_move_to() have the same
> "uninitialized" variable.
>
> Thanks
The above is the only mellanox warning I see. So gcc is able to better
analyze the other callsites.
next prev parent reply other threads:[~2017-04-18 7:24 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-18 6:21 [PATCH] net/mlx4: suppress 'may be used uninitialized' warning Greg Thelen
[not found] ` <20170418062135.76698-1-gthelen-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>
2017-04-18 7:02 ` Leon Romanovsky
2017-04-18 7:24 ` Greg Thelen [this message]
2017-04-20 17:19 ` 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=xr93tw5m18mi.fsf@gthelen.mtv.corp.google.com \
--to=gthelen@google.com \
--cc=amirv@mellanox.com \
--cc=davem@davemloft.net \
--cc=idos@mellanox.com \
--cc=jackm@dev.mellanox.co.il \
--cc=leon@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=matanb@mellanox.com \
--cc=netdev@vger.kernel.org \
--cc=ogerlitz@mellanox.com \
--cc=roland@purestorage.com \
--cc=tariqt@mellanox.com \
--cc=yishaih@mellanox.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