lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Mon, 24 Oct 2016 20:06:42 +0300
From:   Leon Romanovsky <leonro@...lanox.com>
To:     Arnd Bergmann <arnd@...db.de>
Cc:     Matan Barak <matanb@...lanox.com>,
        Doug Ledford <dledford@...hat.com>,
        Sean Hefty <sean.hefty@...el.com>,
        Hal Rosenstock <hal.rosenstock@...il.com>,
        Sagi Grimberg <sagig@...lanox.com>,
        Bart Van Assche <bart.vanassche@...disk.com>,
        Noa Osherovich <noaos@...lanox.com>,
        Saeed Mahameed <saeedm@...lanox.com>,
        linux-rdma@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] IB/mlx5: avoid bogus -Wmaybe-uninitialized warning

On Mon, Oct 24, 2016 at 05:16:42PM +0200, 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.
>
> Signed-off-by: Arnd Bergmann <arnd@...db.de>

Thanks Arnd for fixing it.
I have a very small comment which is not related to functionality.

Rather than that,
Acked-by: Leon Romanovsky <leonro@...lanox.com>

> ---
>  drivers/infiniband/hw/mlx5/mr.c | 39 +++++++++++++++++++++------------------
>  1 file changed, 21 insertions(+), 18 deletions(-)
>
> diff --git a/drivers/infiniband/hw/mlx5/mr.c b/drivers/infiniband/hw/mlx5/mr.c
> index d4ad672b905b..88d8d292677b 100644
> --- a/drivers/infiniband/hw/mlx5/mr.c
> +++ b/drivers/infiniband/hw/mlx5/mr.c
> @@ -815,29 +815,33 @@ static void prep_umr_unreg_wqe(struct mlx5_ib_dev *dev,
>  	umrwr->mkey = key;
>  }
>
> -static struct ib_umem *mr_umem_get(struct ib_pd *pd, u64 start, u64 length,
> -				   int access_flags, int *npages,
> -				   int *page_shift, int *ncont, int *order)
> +static int mr_umem_get(struct ib_pd *pd, u64 start, u64 length,
> +		       int access_flags, struct ib_umem ** umem,

I wonder if checkpatch does differentiate between "struct ib_umem ** umem"
and "struct ib_umem **umem". According to coding style, the second is preferable.

> +		       int *npages, int *page_shift, int *ncont,
> +		       int *order)

Download attachment "signature.asc" of type "application/pgp-signature" (820 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ