[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20210623173819.GV1096940@ziepe.ca>
Date:   Wed, 23 Jun 2021 14:38:19 -0300
From:   Jason Gunthorpe <jgg@...pe.ca>
To:     Colin King <colin.king@...onical.com>
Cc:     Selvin Xavier <selvin.xavier@...adcom.com>,
        Devesh Sharma <devesh.sharma@...adcom.com>,
        Naresh Kumar PBS <nareshkumar.pbs@...adcom.com>,
        Doug Ledford <dledford@...hat.com>,
        Leon Romanovsky <leon@...nel.org>, linux-rdma@...r.kernel.org,
        kernel-janitors@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH][next] RDMA/bnxt_re: Fix uninitialized struct bit field
 rsvd1
On Wed, Jun 23, 2021 at 06:12:02PM +0100, Colin King wrote:
> From: Colin Ian King <colin.king@...onical.com>
> 
> The bit field rsvd1 in resp is not being initialized and garbage data
> is being copied from the stack back to userspace via the ib_copy_to_udata
> call. Fix this by setting rsvd1 to zero. Also remove some whitespace.
> 
> Addresses-Coverity: ("Uninitialized scalar variable")
> Fixes: 879740517dab ("RDMA/bnxt_re: Update ABI to pass wqe-mode to user space")
> Signed-off-by: Colin Ian King <colin.king@...onical.com>
>  drivers/infiniband/hw/bnxt_re/ib_verbs.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/infiniband/hw/bnxt_re/ib_verbs.c b/drivers/infiniband/hw/bnxt_re/ib_verbs.c
> index 5955713234cb..45398f1777aa 100644
> +++ b/drivers/infiniband/hw/bnxt_re/ib_verbs.c
> @@ -3880,7 +3880,8 @@ int bnxt_re_alloc_ucontext(struct ib_ucontext *ctx, struct ib_udata *udata)
>  	resp.pg_size = PAGE_SIZE;
>  	resp.cqe_sz = sizeof(struct cq_base);
>  	resp.max_cqd = dev_attr->max_cq_wqes;
> -	resp.rsvd    = 0;
> +	resp.rsvd = 0;
> +	resp.rsvd1 = 0;
I think I would prefer
	struct bnxt_re_uctx_resp resp = {};
This isn't a performance path
Jason
Powered by blists - more mailing lists