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]
Message-ID: <6fcddba84070c021eb92aa9a5ff15fb2a47e9acb.camel@perches.com>
Date:   Thu, 02 Dec 2021 10:16:23 -0800
From:   Joe Perches <joe@...ches.com>
To:     Christophe JAILLET <christophe.jaillet@...adoo.fr>,
        Juergen Gross <jgross@...e.com>, boris.ostrovsky@...cle.com,
        sstabellini@...nel.org, roger.pau@...rix.com, axboe@...nel.dk
Cc:     xen-devel@...ts.xenproject.org, linux-block@...r.kernel.org,
        linux-kernel@...r.kernel.org, kernel-janitors@...r.kernel.org
Subject: Re: [PATCH] xen-blkfront: Use the bitmap API when applicable

On Thu, 2021-12-02 at 19:12 +0100, Christophe JAILLET wrote:
> Le 02/12/2021 à 07:12, Juergen Gross a écrit :
> > On 01.12.21 22:10, Christophe JAILLET wrote:
> > > Use 'bitmap_zalloc()' to simplify code, improve the semantic and avoid 
> > > some open-coded arithmetic in allocator arguments.
> > > 
> > > Also change the corresponding 'kfree()' into 'bitmap_free()' to keep
> > > consistency.
> > > 
> > > Use 'bitmap_copy()' to avoid an explicit 'memcpy()'
[]
> > > diff --git a/drivers/block/xen-blkfront.c b/drivers/block/xen-blkfront.c
[]
> > > @@ -442,16 +442,14 @@ static int xlbd_reserve_minors(unsigned int 
> > > minor, unsigned int nr)
> > >       if (end > nr_minors) {
> > >           unsigned long *bitmap, *old;
> > > -        bitmap = kcalloc(BITS_TO_LONGS(end), sizeof(*bitmap),
> > > -                 GFP_KERNEL);
> > > +        bitmap = bitmap_zalloc(end, GFP_KERNEL);
> > >           if (bitmap == NULL)
> > >               return -ENOMEM;
> > >           spin_lock(&minor_lock);
> > >           if (end > nr_minors) {
> > >               old = minors;
> > > -            memcpy(bitmap, minors,
> > > -                   BITS_TO_LONGS(nr_minors) * sizeof(*bitmap));
> > > +            bitmap_copy(bitmap, minors, nr_minors);
> > >               minors = bitmap;
> > >               nr_minors = BITS_TO_LONGS(end) * BITS_PER_LONG;

		nr_minors = end;
?


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ