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: <VI1PR0402MB28470F19FE7A585E7F1B184394790@VI1PR0402MB2847.eurprd04.prod.outlook.com>
Date:   Thu, 28 Sep 2017 13:07:48 +0000
From:   Ruxandra Ioana Radulescu <ruxandra.radulescu@....com>
To:     Dan Carpenter <dan.carpenter@...cle.com>
CC:     "gregkh@...uxfoundation.org" <gregkh@...uxfoundation.org>,
        "devel@...verdev.osuosl.org" <devel@...verdev.osuosl.org>,
        "arnd@...db.de" <arnd@...db.de>,
        "stuyoder@...il.com" <stuyoder@...il.com>,
        Roy Pledge <roy.pledge@....com>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        "agraf@...e.de" <agraf@...e.de>,
        "Bogdan Purcareata" <bogdan.purcareata@....com>,
        Laurentiu Tudor <laurentiu.tudor@....com>
Subject: RE: [PATCH] staging: fsl-mc/dpio: Fix incorrect comparison

> -----Original Message-----
> From: Dan Carpenter [mailto:dan.carpenter@...cle.com]
> Sent: Thursday, September 28, 2017 3:49 PM
> To: Ruxandra Ioana Radulescu <ruxandra.radulescu@....com>
> Cc: gregkh@...uxfoundation.org; devel@...verdev.osuosl.org;
> arnd@...db.de; stuyoder@...il.com; Roy Pledge <roy.pledge@....com>;
> linux-kernel@...r.kernel.org; agraf@...e.de; Bogdan Purcareata
> <bogdan.purcareata@....com>; Laurentiu Tudor
> <laurentiu.tudor@....com>
> Subject: Re: [PATCH] staging: fsl-mc/dpio: Fix incorrect comparison
> 
> 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.
 
I was under the impression it's ok to use them on hotpath
(and while not entirely obvious, this function is called on
other drivers' hotpath).

> Please write it more explicitly like this:
> 
> 	if (cpu != -1 && cpu >= num_possible_cpus())
> 		return NULL;
> 
> Same for the other one as well.

Will rewrite as you suggested in the second email and send a v2.

Thanks,
Ioana

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ