Skip to contentSkip to conversation

powerpc: Sky CPU: redundant or incorrect tests on unsigned

PATCH In review [email protected] 2 participants 3 messages Dec 18, 2009 Char and misc drivers

lore
Share & tools
lore
#0 lore raw

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

From: Roel Kluin <[email protected]>

count is unsigned and cannot be less than 0.

---

 drivers/misc/hdpuftrs/hdpu_cpustate.c |    5 -----
 1 file changed, 5 deletions(-)
drivers/misc/hdpuftrs/hdpu_cpustate.c renamed from drivers/misc/hdpuftrs/hdpu_cpustate.c~powerpc-sky-cpu-redundant-or-incorrect-tests-on-unsigned +0 -5
diff -puN drivers/misc/hdpuftrs/hdpu_cpustate.c~powerpc-sky-cpu-redundant-or-incorrect-tests-on-unsigned 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;
 

_

#1 lore raw
Quoted 3 lines · On Thu, 2009-12-17 at 16:44 -0800, [email protected] wrote:

From: Roel Kluin <[email protected]>

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.

Quoted 34 lines

---

 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

drivers/misc/hdpuftrs/hdpu_cpustate.c renamed from drivers/misc/hdpuftrs/hdpu_cpustate.c~powerpc-sky-cpu-redundant-or-incorrect-tests-on-unsigned +0 -5
@@ -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;
 

_

#2 lore raw
Quoted 11 lines · Benjamin Herrenschmidt
Quoted 3 lines · On Thu, 2009-12-17 at 16:44 -0800, [email protected] wrote:

From: Roel Kluin <[email protected]>

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.

Quoted 38 lines

Cheers,
Ben.

Quoted 34 lines

---

 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

drivers/misc/hdpuftrs/hdpu_cpustate.c renamed from drivers/misc/hdpuftrs/hdpu_cpustate.c~powerpc-sky-cpu-redundant-or-incorrect-tests-on-unsigned +0 -5
@@ -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;
 

_