From: Liu Shixin <liushixin2@huawei.com>
To: Leon Romanovsky <leon@kernel.org>, Jason Gunthorpe <jgg@ziepe.ca>
Cc: 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: Fri, 18 Sep 2020 11:23:18 +0800 [thread overview]
Message-ID: <59dfb43f-04a7-b02a-1619-81d92ca69278@huawei.com> (raw)
In-Reply-To: <20200917173346.GK869610@unreal>
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.
>
>> Jason
> .
>
next prev parent reply other threads:[~2020-09-18 3:23 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-17 8:13 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 [this message]
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=59dfb43f-04a7-b02a-1619-81d92ca69278@huawei.com \
--to=liushixin2@huawei.com \
--cc=dledford@redhat.com \
--cc=jgg@ziepe.ca \
--cc=leon@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rdma@vger.kernel.org \
/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
all inboxes | Powered by JetHome®