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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:	Thu, 22 May 2014 20:50:24 +0200
From:	Fabian Frederick <fabf@...net.be>
To:	Guenter Roeck <linux@...ck-us.net>
Cc:	Joe Perches <joe@...ches.com>,
	linux-kernel <linux-kernel@...r.kernel.org>,
	Kurt Garloff <garloff@...e.de>,
	akpm <akpm@...ux-foundation.org>
Subject: Re: [PATCH 1/1] drivers/scsi/tmscsim.c: replace shift loop by ilog2

On Wed, 21 May 2014 20:29:39 -0700
Guenter Roeck <linux@...ck-us.net> wrote:

> On 05/21/2014 06:03 PM, Joe Perches wrote:
> > On Wed, 2014-05-21 at 17:28 -0700, Guenter Roeck wrote:
> >> On Tue, May 20, 2014 at 10:06:42AM -0700, Joe Perches wrote:
> >>> On Tue, 2014-05-20 at 18:48 +0200, Fabian Frederick wrote:
> >>>> Cc: Kurt Garloff <garloff@...e.de>
> >>>> Cc: Andrew Morton <akpm@...ux-foundation.org>
> >>>> Signed-off-by: Fabian Frederick <fabf@...net.be>
> >>>> ---
> >>>>   drivers/scsi/tmscsim.c | 2 +-
> >>>>   1 file changed, 1 insertion(+), 1 deletion(-)
> >>>>
> >>>> diff --git a/drivers/scsi/tmscsim.c b/drivers/scsi/tmscsim.c
> >>> []
> >>>> @@ -1611,7 +1611,7 @@ dc390_Reselect( struct dc390_acb* pACB )
> >>>>         printk (KERN_ERR "DC390: Reselection must select host adapter: %02x!\n", lun);
> >>>>       else
> >>>>         lun ^= 1 << pACB->pScsiHost->this_id; /* Mask AdapterID */
> >>>> -    id = 0; while (lun >>= 1) id++;
> >>>> +    id = ilog2(lun);
> >>>>       /* Get LUN */
> >>>>       lun = DC390_read8 (ScsiFifo);
> >>>>       if (!(lun & IDENTIFY_BASE)) printk (KERN_ERR "DC390: Resel: Expect identify message!\n");
> >>>
> >>> Hey Fabian.
> >>>
> >>> You've submitted several of these now.
> >>>
> >>> Have you gone through all of these to make sure
> >>> that the ilog2(<foo>) uses are always using a
> >>> non-zero <foo>?
> >>>
> >> Maybe I am missing something. Why not just use fls() ?
> >
> > fls strains Andrew Morton's brain.
> >
> > https://lkml.org/lkml/2014/5/19/771
> >
> 
> :-).
> 
> On the other side fls(1) == 1 while ilog2(1) == 0. So some test is necessary anyway.
> 
> Guenter
> 

I wasn't aware of a problem with 0 value ... I guess we can forget 
conversion here.

Fabian
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ