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: <YM3NDrgF3znR+/4z@smile.fi.intel.com>
Date:   Sat, 19 Jun 2021 13:55:10 +0300
From:   Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
To:     Yury Norov <yury.norov@...il.com>
Cc:     Thomas Gleixner <tglx@...utronix.de>,
        Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
        "H. Peter Anvin" <hpa@...or.com>,
        Lucas Stach <l.stach@...gutronix.de>,
        Russell King <linux+etnaviv@...linux.org.uk>,
        Christian Gmeiner <christian.gmeiner@...il.com>,
        David Airlie <airlied@...ux.ie>,
        Daniel Vetter <daniel@...ll.ch>,
        Jean Delvare <jdelvare@...e.com>,
        Guenter Roeck <linux@...ck-us.net>,
        Rasmus Villemoes <linux@...musvillemoes.dk>,
        Marc Zyngier <maz@...nel.org>,
        David Woodhouse <dwmw@...zon.co.uk>,
        Andrew Morton <akpm@...ux-foundation.org>,
        Wei Yang <richard.weiyang@...ux.alibaba.com>,
        Geert Uytterhoeven <geert+renesas@...der.be>,
        Alexey Klimov <aklimov@...hat.com>, x86@...nel.org,
        linux-kernel@...r.kernel.org, etnaviv@...ts.freedesktop.org,
        dri-devel@...ts.freedesktop.org, linux-hwmon@...r.kernel.org
Subject: Re: [PATCH 3/3] Replace for_each_*_bit_from() with for_each_*_bit()
 where appropriate

On Sat, Jun 19, 2021 at 01:49:58PM +0300, Andy Shevchenko wrote:
> On Fri, Jun 18, 2021 at 12:57:35PM -0700, Yury Norov wrote:
> > A couple of kernel functions call for_each_*_bit_from() with start
> > bit equal to 0. Replace them with for_each_*_bit().
> > 
> > No functional changes, but might improve on readability.
> 
> ...
> 
> > --- a/drivers/hwmon/ltc2992.c
> > +++ b/drivers/hwmon/ltc2992.c
> > @@ -248,8 +248,7 @@ static int ltc2992_gpio_get_multiple(struct gpio_chip *chip, unsigned long *mask
> >  
> >  	gpio_status = reg;
> >  
> > -	gpio_nr = 0;
> > -	for_each_set_bit_from(gpio_nr, mask, LTC2992_GPIO_NR) {
> > +	for_each_set_bit(gpio_nr, mask, LTC2992_GPIO_NR) {
> >  		if (test_bit(LTC2992_GPIO_BIT(gpio_nr), &gpio_status))
> >  			set_bit(gpio_nr, bits);
> >  	}
> 
> I would replace the entire loop by bitmap_replace() call.
> 
> Something like
> 	bitmap_replace(bits, bits, &gpio_status, mask, LTC2992_GPIO_NR);

Okay, it wouldn't work directly because it involves LTC2992_GPIO_BIT()
macro. So, it rather some kind of bitmap_remap().

-- 
With Best Regards,
Andy Shevchenko


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ