lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Mon, 21 Sep 2020 16:26:08 +0300
From:   Leon Romanovsky <leon@...nel.org>
To:     Liu Shixin <liushixin2@...wei.com>
Cc:     Jason Gunthorpe <jgg@...pe.ca>, 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 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@...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 *".
> >> 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
> > .
> >
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ