linux-rdma.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Doug Ledford <dledford@redhat.com>
To: Arnd Bergmann <arnd@arndb.de>, Sean Hefty <sean.hefty@intel.com>,
	Hal Rosenstock <hal.rosenstock@gmail.com>
Cc: Matan Barak <matanb@mellanox.com>,
	Leon Romanovsky <leonro@mellanox.com>,
	Sagi Grimberg <sagig@mellanox.com>,
	Bart Van Assche <bart.vanassche@sandisk.com>,
	Noa Osherovich <noaos@mellanox.com>,
	Saeed Mahameed <saeedm@mellanox.com>,
	linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] IB/mlx5: avoid bogus -Wmaybe-uninitialized warning
Date: Wed, 14 Dec 2016 12:13:14 -0500	[thread overview]
Message-ID: <2de76e2f-78ff-13d6-9c93-8f888d4508c1@redhat.com> (raw)
In-Reply-To: <20161024204830.620592-1-arnd@arndb.de>


[-- Attachment #1.1: Type: text/plain, Size: 1717 bytes --]

On 10/24/2016 4:48 PM, Arnd Bergmann wrote:
> We get a false-positive warning in linux-next for the mlx5 driver:
> 
> infiniband/hw/mlx5/mr.c: In function ‘mlx5_ib_reg_user_mr’:
> infiniband/hw/mlx5/mr.c:1172:5: error: ‘order’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
> infiniband/hw/mlx5/mr.c:1161:6: note: ‘order’ was declared here
> infiniband/hw/mlx5/mr.c:1173:6: error: ‘ncont’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
> infiniband/hw/mlx5/mr.c:1160:6: note: ‘ncont’ was declared here
> infiniband/hw/mlx5/mr.c:1173:6: error: ‘page_shift’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
> infiniband/hw/mlx5/mr.c:1158:6: note: ‘page_shift’ was declared here
> infiniband/hw/mlx5/mr.c:1143:13: error: ‘npages’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
> infiniband/hw/mlx5/mr.c:1159:6: note: ‘npages’ was declared here
> 
> I had a trivial workaround for gcc-5 or higher, but that didn't work
> on gcc-4.9 unfortunately.
> 
> The only way I found to avoid the warnings for gcc-4.9, short of
> initializing each of the arguments first was to change the calling
> conventions to separate the error code from the umem pointer. This
> avoids casting the error codes from one pointer to another incompatible
> pointer, and lets gcc figure out when that the data is actually valid
> whenever we return successfully.
> 
> Acked-by: Leon Romanovsky <leonro@mellanox.com>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

Thanks, applied (with fixups due to conflicts).

-- 
Doug Ledford <dledford@redhat.com>
    GPG Key ID: 0E572FDD


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 884 bytes --]

      parent reply	other threads:[~2016-12-14 17:13 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-24 20:48 [PATCH v2] IB/mlx5: avoid bogus -Wmaybe-uninitialized warning Arnd Bergmann
     [not found] ` <20161024204830.620592-1-arnd-r2nGTMty4D4@public.gmane.org>
2016-10-25  5:40   ` Leon Romanovsky
2016-12-14 17:13 ` Doug Ledford [this message]

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=2de76e2f-78ff-13d6-9c93-8f888d4508c1@redhat.com \
    --to=dledford@redhat.com \
    --cc=arnd@arndb.de \
    --cc=bart.vanassche@sandisk.com \
    --cc=hal.rosenstock@gmail.com \
    --cc=leonro@mellanox.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=matanb@mellanox.com \
    --cc=noaos@mellanox.com \
    --cc=saeedm@mellanox.com \
    --cc=sagig@mellanox.com \
    --cc=sean.hefty@intel.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).