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: <20200828102935.GC5098@quack2.suse.cz>
Date:   Fri, 28 Aug 2020 12:29:35 +0200
From:   Jan Kara <jack@...e.cz>
To:     "Gustavo A. R. Silva" <gustavo@...eddedor.com>
Cc:     Denis Efremov <efremov@...ux.com>, Jan Kara <jack@...e.com>,
        linux-kernel@...r.kernel.org, Joe Perches <joe@...ches.com>
Subject: Re: [PATCH v3] udf: Use kvzalloc() in udf_sb_alloc_bitmap()

On Thu 27-08-20 17:29:25, Gustavo A. R. Silva wrote:
> 
> 
> On 8/27/20 17:16, Denis Efremov wrote:
> > Use kvzalloc() in udf_sb_alloc_bitmap() instead of open-coding it.
> > Size computation wrapped in struct_size() macro to prevent potential
> > integer overflows.
> > 
> > Signed-off-by: Denis Efremov <efremov@...ux.com>
> 
> Looks good. :)
> 
> Reviewed-by: Gustavo A. R. Silva <gustavoars@...nel.org>

Thank you both. I've added the patch to my tree.

								Honza

> 
> Thanks
> --
> Gustavo
> 
> > ---
> > Changes in v2:
> >  - size computation wrapped in struct_size()
> > Changes in v3:
> >  - int size dropped
> > 
> >  fs/udf/super.c | 14 +++-----------
> >  1 file changed, 3 insertions(+), 11 deletions(-)
> > 
> > diff --git a/fs/udf/super.c b/fs/udf/super.c
> > index 1c42f544096d..d9eabbe368ff 100644
> > --- a/fs/udf/super.c
> > +++ b/fs/udf/super.c
> > @@ -1006,18 +1006,10 @@ int udf_compute_nr_groups(struct super_block *sb, u32 partition)
> >  static struct udf_bitmap *udf_sb_alloc_bitmap(struct super_block *sb, u32 index)
> >  {
> >  	struct udf_bitmap *bitmap;
> > -	int nr_groups;
> > -	int size;
> > -
> > -	nr_groups = udf_compute_nr_groups(sb, index);
> > -	size = sizeof(struct udf_bitmap) +
> > -		(sizeof(struct buffer_head *) * nr_groups);
> > -
> > -	if (size <= PAGE_SIZE)
> > -		bitmap = kzalloc(size, GFP_KERNEL);
> > -	else
> > -		bitmap = vzalloc(size); /* TODO: get rid of vzalloc */
> > +	int nr_groups = udf_compute_nr_groups(sb, index);
> >  
> > +	bitmap = kvzalloc(struct_size(bitmap, s_block_bitmap, nr_groups),
> > +			  GFP_KERNEL);
> >  	if (!bitmap)
> >  		return NULL;
> >  
> > 
> 
-- 
Jan Kara <jack@...e.com>
SUSE Labs, CR

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ