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  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [day] [month] [year] [list]
Date:	Thu, 22 May 2014 12:22:38 +0200
From:	Ursula Braun <ubraun@...ux.vnet.ibm.com>
To:	Sebastian Ott <sebott@...ux.vnet.ibm.com>
Cc:	Joe Perches <joe@...ches.com>, ursula.braun@...ibm.com,
	Fabian Frederick <fabf@...net.be>,
	linux-kernel@...r.kernel.org, akpm <akpm@...ux-foundation.org>
Subject: Re: [PATCH 1/1] drivers/s390/cio/qdio_main.c: replace shift loop by
 ilog2

yes, the callers guarantee that count > 0 here.

Regards, Ursula Braun

On Thu, 2014-05-22 at 12:14 +0200, Ursula Braun1 wrote:
> From:        Sebastian Ott <sebott@...ux.vnet.ibm.com> 
> To:        Joe Perches <joe@...ches.com>, Ursula
> Braun1/Germany/IBM@...DE, 
> Cc:        Fabian Frederick <fabf@...net.be>, linux-kernel
> <linux-kernel@...r.kernel.org>, akpm <akpm@...ux-foundation.org> 
> Date:        21/05/2014 14:32 
> Subject:        Re: [PATCH 1/1] drivers/s390/cio/qdio_main.c: replace
> shift loop by ilog2 
> 
> ______________________________________________________________________
> 
> 
> 
> On Tue, 20 May 2014, Joe Perches wrote:
> > On Tue, 2014-05-20 at 18:37 +0200, Fabian Frederick wrote:
> > > This is untested.
> > []
> > > diff --git a/drivers/s390/cio/qdio_main.c
> b/drivers/s390/cio/qdio_main.c
> > []
> > > @@ -411,15 +411,14 @@ static inline void qdio_stop_polling(struct
> qdio_q *q)
> > >  
> > >  static inline void account_sbals(struct qdio_q *q, int count)
> > >  {
> > > -                 int pos = 0;
> > > +                 int pos;
> > >  
> > >                   q->q_stats.nr_sbal_total += count;
> > >                   if (count == QDIO_MAX_BUFFERS_MASK) {
> > >                                    q->q_stats.nr_sbals[7]++;
> > >                                    return;
> > >                   }
> > > -                 while (count >>= 1)
> > > -                                  pos++;
> > > +                 pos = ilog2(count);
> > 
> > What guarantees count > 0 here?
> 
> We would already be screwed when called with count < 0. Ursula, do the
> callers assure that count is positive?
> 
> Regards,
> Sebastian
> > 
> > count may be better unsigned.
> > 
> > 


--
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