public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Leon Romanovsky <leon@kernel.org>
To: Liu Shixin <liushixin2@huawei.com>
Cc: Jason Gunthorpe <jgg@ziepe.ca>,
	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: Mon, 21 Sep 2020 16:26:08 +0300	[thread overview]
Message-ID: <20200921132608.GD1223944@unreal> (raw)
In-Reply-To: <59dfb43f-04a7-b02a-1619-81d92ca69278@huawei.com>

On Fri, Sep 18, 2020 at 11:23:18AM +0800, Liu Shixin wrote:
> On 2020/9/18 1:33, Leon Romanovsky wrote:
> > On Thu, Sep 17, 2020 at 02:24:51PM -0300, Jason Gunthorpe wrote:
> >> 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
> > No problem, I'll check.
> I think cnts->offsets is an array pointer whose element is size_t rathen than pointer,
> so the patch description does not correspond.
> And I think it should be modified to sizeof(*cnts->offsets) with other description.

Sorry for me being wrong, you are right.

Thanks

> >
> >> Jason
> > .
> >
>

  reply	other threads:[~2020-09-21 13: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
2020-09-17 17:33             ` Leon Romanovsky
2020-09-18  3:23               ` Liu Shixin
2020-09-21 13:26                 ` Leon Romanovsky [this message]
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=20200921132608.GD1223944@unreal \
    --to=leon@kernel.org \
    --cc=dledford@redhat.com \
    --cc=jgg@ziepe.ca \
    --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