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] [day] [month] [year] [list]
Message-ID: <20210928115142.GH964074@nvidia.com>
Date:   Tue, 28 Sep 2021 08:51:42 -0300
From:   Jason Gunthorpe <jgg@...dia.com>
To:     Mark Zhang <markzhang@...dia.com>
Cc:     Leon Romanovsky <leon@...nel.org>,
        Doug Ledford <dledford@...hat.com>,
        Aharon Landau <aharonl@...dia.com>,
        "David S. Miller" <davem@...emloft.net>,
        Dennis Dalessandro <dennis.dalessandro@...nelisnetworks.com>,
        Gal Pressman <galpress@...zon.com>,
        Jakub Kicinski <kuba@...nel.org>, linux-kernel@...r.kernel.org,
        linux-rdma@...r.kernel.org, Maor Gottlieb <maorg@...dia.com>,
        Mike Marciniszyn <mike.marciniszyn@...nelisnetworks.com>,
        Mustafa Ismail <mustafa.ismail@...el.com>,
        Naresh Kumar PBS <nareshkumar.pbs@...adcom.com>,
        netdev@...r.kernel.org, Potnuri Bharat Teja <bharat@...lsio.com>,
        Saeed Mahameed <saeedm@...dia.com>,
        Selvin Xavier <selvin.xavier@...adcom.com>,
        Shiraz Saleem <shiraz.saleem@...el.com>,
        Yishai Hadas <yishaih@...dia.com>,
        Zhu Yanjun <zyjzyj2000@...il.com>
Subject: Re: [PATCH rdma-next v1 04/11] RDMA/counter: Add an is_disabled
 field in struct rdma_hw_stats

On Tue, Sep 28, 2021 at 11:28:39AM +0800, Mark Zhang wrote:
> On 9/28/2021 12:53 AM, Jason Gunthorpe wrote:
> > On Wed, Sep 15, 2021 at 02:07:23AM +0300, Leon Romanovsky wrote:
> > 
> > > diff --git a/drivers/infiniband/core/nldev.c b/drivers/infiniband/core/nldev.c
> > > index 3f6b98a87566..67519730b1ac 100644
> > > +++ b/drivers/infiniband/core/nldev.c
> > > @@ -968,15 +968,21 @@ static int fill_stat_counter_hwcounters(struct sk_buff *msg,
> > >   	if (!table_attr)
> > >   		return -EMSGSIZE;
> > > @@ -601,11 +604,20 @@ static inline struct rdma_hw_stats *rdma_alloc_hw_stats_struct(
> > >   	if (!stats)
> > >   		return NULL;
> > > +	stats->is_disabled = kcalloc(BITS_TO_LONGS(num_counters),
> > > +				      sizeof(long), GFP_KERNEL);
> > > +	if (!stats->is_disabled)
> > > +		goto err;
> > > +
> > 
> > Please de-inline this function and make a rdma_free_hw_stats_struct()
> > call to pair with it. The hw_stats_data kfree should be in there. If
> > you do this as a precursor patch this patch will be much smaller.
> > 
> > Also, the
> > 
> >          stats = kzalloc(sizeof(*stats) + num_counters * sizeof(u64),
> >                          GFP_KERNEL);
> > 
> > Should be using array_size
> Maybe use struct_size:
>   stats = kzalloc(struct_size(stats, value, num_counters), GFP_KERNEL);

Right

Jason

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ