[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200917170511.GI869610@unreal>
Date: Thu, 17 Sep 2020 20:05:11 +0300
From: Leon Romanovsky <leon@...nel.org>
To: Jason Gunthorpe <jgg@...dia.com>
Cc: Liu Shixin <liushixin2@...wei.com>,
Doug Ledford <dledford@...hat.com>, linux-rdma@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH -next] RDMA/mlx5: fix type warning of sizeof in
__mlx5_ib_alloc_counters()
On Thu, Sep 17, 2020 at 09:38:06AM -0300, Jason Gunthorpe wrote:
> On Thu, Sep 17, 2020 at 12:08:10PM +0300, Leon Romanovsky wrote:
> > On Thu, Sep 17, 2020 at 05:10:08PM +0800, Liu Shixin wrote:
> > > sizeof() when applied to a pointer typed expression should give the
> > > size of the pointed data, even if the data is a pointer.
> > >
> > > Signed-off-by: Liu Shixin <liushixin2@...wei.com>
>
> Needs a fixes line
>
> > > if (!cnts->names)
> > > return -ENOMEM;
> > >
> > > cnts->offsets = kcalloc(num_counters,
> > > - sizeof(cnts->offsets), GFP_KERNEL);
> > > + sizeof(*cnts->offsets), GFP_KERNEL);
> >
> > This is not.
>
> Why not?
cnts->offsets is array of pointers that we will set later.
The "sizeof(*cnts->offsets)" will return the size of size_t, while we
need to get "size_t *".
Thanks
>
> Jason
Powered by blists - more mailing lists