diff mbox

[1/5] powerpc: Sky CPU: redundant or incorrect tests on unsigned

Message ID 200912180044.nBI0iTbj028399@imap1.linux-foundation.org (mailing list archive)
State Rejected
Delegated to: Benjamin Herrenschmidt
Headers show

Commit Message

Andrew Morton Dec. 18, 2009, 12:44 a.m. UTC
From: Roel Kluin <roel.kluin@gmail.com>

count is unsigned and cannot be less than 0.

Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
Acked-by: Cyrill Gorcunov <gorcunov@gmail.com>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Kumar Gala <galak@gate.crashing.org>
Cc: Brian Waite <waite@skycomputers.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---

 drivers/misc/hdpuftrs/hdpu_cpustate.c |    5 -----
 1 file changed, 5 deletions(-)

Comments

Benjamin Herrenschmidt Dec. 18, 2009, 3:40 a.m. UTC | #1
On Thu, 2009-12-17 at 16:44 -0800, akpm@linux-foundation.org wrote:
> From: Roel Kluin <roel.kluin@gmail.com>
> 
> count is unsigned and cannot be less than 0.

Is this really a powerpc thing ?

This driver is only build with CONFIG_HDPU_FEATURES and a git grep
HDPU_FEATURES returns no Kconfig that defines it :-)

I'm happy to apply such a trivial thing but it's weird isn't it ?

Cheers,
Ben.

> Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
> Acked-by: Cyrill Gorcunov <gorcunov@gmail.com>
> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> Cc: Kumar Gala <galak@gate.crashing.org>
> Cc: Brian Waite <waite@skycomputers.com>
> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
> ---
> 
>  drivers/misc/hdpuftrs/hdpu_cpustate.c |    5 -----
>  1 file changed, 5 deletions(-)
> 
> diff -puN drivers/misc/hdpuftrs/hdpu_cpustate.c~powerpc-sky-cpu-redundant-or-incorrect-tests-on-unsigned drivers/misc/hdpuftrs/hdpu_cpustate.c
> --- a/drivers/misc/hdpuftrs/hdpu_cpustate.c~powerpc-sky-cpu-redundant-or-incorrect-tests-on-unsigned
> +++ a/drivers/misc/hdpuftrs/hdpu_cpustate.c
> @@ -121,8 +121,6 @@ static ssize_t cpustate_read(struct file
>  {
>  	unsigned char data;
>  
> -	if (count < 0)
> -		return -EFAULT;
>  	if (count == 0)
>  		return 0;
>  
> @@ -137,9 +135,6 @@ static ssize_t cpustate_write(struct fil
>  {
>  	unsigned char data;
>  
> -	if (count < 0)
> -		return -EFAULT;
> -
>  	if (count == 0)
>  		return 0;
>  
> _
Benjamin Herrenschmidt Dec. 18, 2009, 3:45 a.m. UTC | #2
On Fri, 2009-12-18 at 14:40 +1100, Benjamin Herrenschmidt wrote:
> On Thu, 2009-12-17 at 16:44 -0800, akpm@linux-foundation.org wrote:
> > From: Roel Kluin <roel.kluin@gmail.com>
> > 
> > count is unsigned and cannot be less than 0.
> 
> Is this really a powerpc thing ?
> 
> This driver is only build with CONFIG_HDPU_FEATURES and a git grep
> HDPU_FEATURES returns no Kconfig that defines it :-)
> 
> I'm happy to apply such a trivial thing but it's weird isn't it ?

Ok so it looks like some old stuff that got removed a long time ago and
never made it to arch/powerpc.

I'll send a patch to just remove the whole driver, it's stale.

Cheers,
Ben.

> Cheers,
> Ben.
> 
> > Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
> > Acked-by: Cyrill Gorcunov <gorcunov@gmail.com>
> > Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> > Cc: Kumar Gala <galak@gate.crashing.org>
> > Cc: Brian Waite <waite@skycomputers.com>
> > Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
> > ---
> > 
> >  drivers/misc/hdpuftrs/hdpu_cpustate.c |    5 -----
> >  1 file changed, 5 deletions(-)
> > 
> > diff -puN drivers/misc/hdpuftrs/hdpu_cpustate.c~powerpc-sky-cpu-redundant-or-incorrect-tests-on-unsigned drivers/misc/hdpuftrs/hdpu_cpustate.c
> > --- a/drivers/misc/hdpuftrs/hdpu_cpustate.c~powerpc-sky-cpu-redundant-or-incorrect-tests-on-unsigned
> > +++ a/drivers/misc/hdpuftrs/hdpu_cpustate.c
> > @@ -121,8 +121,6 @@ static ssize_t cpustate_read(struct file
> >  {
> >  	unsigned char data;
> >  
> > -	if (count < 0)
> > -		return -EFAULT;
> >  	if (count == 0)
> >  		return 0;
> >  
> > @@ -137,9 +135,6 @@ static ssize_t cpustate_write(struct fil
> >  {
> >  	unsigned char data;
> >  
> > -	if (count < 0)
> > -		return -EFAULT;
> > -
> >  	if (count == 0)
> >  		return 0;
> >  
> > _
>
diff mbox

Patch

diff -puN drivers/misc/hdpuftrs/hdpu_cpustate.c~powerpc-sky-cpu-redundant-or-incorrect-tests-on-unsigned drivers/misc/hdpuftrs/hdpu_cpustate.c
--- a/drivers/misc/hdpuftrs/hdpu_cpustate.c~powerpc-sky-cpu-redundant-or-incorrect-tests-on-unsigned
+++ a/drivers/misc/hdpuftrs/hdpu_cpustate.c
@@ -121,8 +121,6 @@  static ssize_t cpustate_read(struct file
 {
 	unsigned char data;
 
-	if (count < 0)
-		return -EFAULT;
 	if (count == 0)
 		return 0;
 
@@ -137,9 +135,6 @@  static ssize_t cpustate_write(struct fil
 {
 	unsigned char data;
 
-	if (count < 0)
-		return -EFAULT;
-
 	if (count == 0)
 		return 0;