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]
Date:   Thu, 28 Sep 2017 15:53:37 +0300
From:   Dan Carpenter <dan.carpenter@...cle.com>
To:     Ioana Radulescu <ruxandra.radulescu@....com>
Cc:     devel@...verdev.osuosl.org, arnd@...db.de, stuyoder@...il.com,
        gregkh@...uxfoundation.org, roy.pledge@....com,
        linux-kernel@...r.kernel.org, agraf@...e.de,
        bogdan.purcareata@....com, laurentiu.tudor@....com
Subject: Re: [PATCH] staging: fsl-mc/dpio: Fix incorrect comparison

On Thu, Sep 28, 2017 at 03:48:36PM +0300, Dan Carpenter wrote:
> On Wed, Sep 27, 2017 at 12:57:28PM -0500, Ioana Radulescu wrote:
> > diff --git a/drivers/staging/fsl-mc/bus/dpio/dpio-service.c b/drivers/staging/fsl-mc/bus/dpio/dpio-service.c
> > index f809682..26922fc 100644
> > --- a/drivers/staging/fsl-mc/bus/dpio/dpio-service.c
> > +++ b/drivers/staging/fsl-mc/bus/dpio/dpio-service.c
> > @@ -76,7 +76,7 @@ static inline struct dpaa2_io *service_select_by_cpu(struct dpaa2_io *d,
> >  	if (d)
> >  		return d;
> >  
> > -	if (unlikely(cpu >= num_possible_cpus()))
> > +	if (unlikely(cpu >= (int)num_possible_cpus()))
> 
> 
> Drivers shouldn't use likely/unlikley.  Please write it more explicitly
> like this:
> 
> 	if (cpu != -1 && cpu >= num_possible_cpus())

This would probably be more readable as a define.

	if (cpu != DPAA_ANY_CPU && cpu >= num_possible_cpus())
		return NULL;

regards,
dan carpenter

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ