From: Jason Gunthorpe <jgg@ziepe.ca>
To: Leon Romanovsky <leon@kernel.org>
Cc: Liu Shixin <liushixin2@huawei.com>,
Doug Ledford <dledford@redhat.com>,
linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH -next] RDMA/mlx5: fix type warning of sizeof in __mlx5_ib_alloc_counters()
Date: Thu, 17 Sep 2020 14:24:51 -0300 [thread overview]
Message-ID: <20200917172451.GK8409@ziepe.ca> (raw)
In-Reply-To: <20200917170511.GI869610@unreal>
On Thu, Sep 17, 2020 at 08:05:11PM +0300, Leon Romanovsky wrote:
> 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@huawei.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 *".
Then why isn't a pointer to size **?
Something is rotten here
Jason
next prev parent reply other threads:[~2020-09-17 17:26 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-17 8:13 [PATCH -next] RDMA/mlx5: fix type warning of sizeof in __mlx5_ib_alloc_counters() Liu Shixin
2020-09-17 8:29 ` Leon Romanovsky
2020-09-17 9:10 ` Liu Shixin
2020-09-17 9:08 ` Leon Romanovsky
2020-09-17 9:52 ` [PATCH -next v2] " Liu Shixin
2020-09-17 10:09 ` Leon Romanovsky
2020-09-17 12:38 ` [PATCH -next] " Jason Gunthorpe
2020-09-17 17:05 ` Leon Romanovsky
2020-09-17 17:24 ` Jason Gunthorpe [this message]
2020-09-17 17:33 ` Leon Romanovsky
2020-09-18 3:23 ` Liu Shixin
2020-09-21 13:26 ` Leon Romanovsky
2020-09-25 12:41 ` Jason Gunthorpe
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=20200917172451.GK8409@ziepe.ca \
--to=jgg@ziepe.ca \
--cc=dledford@redhat.com \
--cc=leon@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=liushixin2@huawei.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).