public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [Patch] Signedness issue in drivers/scsi/ipr.c
@ 2006-08-19 19:13 Eric Sesterhenn
  2006-08-20 18:20 ` Alan Cox
  2006-08-20 18:56 ` Brian King
  0 siblings, 2 replies; 3+ messages in thread
From: Eric Sesterhenn @ 2006-08-19 19:13 UTC (permalink / raw)
  To: linux-kernel; +Cc: brking

hi,

gcc 4.1 with some extra warnings show the following:

drivers/scsi/ipr.c:6361: warning: comparison of unsigned expression < 0 is always false
drivers/scsi/ipr.c:6385: warning: comparison of unsigned expression < 0 is always false
drivers/scsi/ipr.c:6415: warning: comparison of unsigned expression < 0 is always false

The problem is that rc is of the type u32, which can never be smaller than zero,
therefore all three error handling checks get useless. This patch changes it to
a normal int, because all usages / all functions it get used with expect an int.

Signed-off-by: Eric Sesterhenn <snakebyte@gmx.de>

--- linux-2.6.18-rc4/drivers/scsi/ipr.c.orig	2006-08-19 21:10:18.000000000 +0200
+++ linux-2.6.18-rc4/drivers/scsi/ipr.c	2006-08-19 21:10:25.000000000 +0200
@@ -6324,7 +6324,7 @@ static int __devinit ipr_probe_ioa(struc
 	struct Scsi_Host *host;
 	unsigned long ipr_regs_pci;
 	void __iomem *ipr_regs;
-	u32 rc = PCIBIOS_SUCCESSFUL;
+	int rc = PCIBIOS_SUCCESSFUL;
 	volatile u32 mask, uproc;
 
 	ENTER;



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Patch] Signedness issue in drivers/scsi/ipr.c
  2006-08-19 19:13 [Patch] Signedness issue in drivers/scsi/ipr.c Eric Sesterhenn
@ 2006-08-20 18:20 ` Alan Cox
  2006-08-20 18:56 ` Brian King
  1 sibling, 0 replies; 3+ messages in thread
From: Alan Cox @ 2006-08-20 18:20 UTC (permalink / raw)
  To: Eric Sesterhenn; +Cc: linux-kernel, brking

Ar Sad, 2006-08-19 am 21:13 +0200, ysgrifennodd Eric Sesterhenn:
> hi,
> 
> gcc 4.1 with some extra warnings show the following:
> 
> drivers/scsi/ipr.c:6361: warning: comparison of unsigned expression < 0 is always false
> drivers/scsi/ipr.c:6385: warning: comparison of unsigned expression < 0 is always false
> drivers/scsi/ipr.c:6415: warning: comparison of unsigned expression < 0 is always false
> 

Acked-by: Alan Cox <alan@redhat.com>


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Patch] Signedness issue in drivers/scsi/ipr.c
  2006-08-19 19:13 [Patch] Signedness issue in drivers/scsi/ipr.c Eric Sesterhenn
  2006-08-20 18:20 ` Alan Cox
@ 2006-08-20 18:56 ` Brian King
  1 sibling, 0 replies; 3+ messages in thread
From: Brian King @ 2006-08-20 18:56 UTC (permalink / raw)
  To: Eric Sesterhenn; +Cc: linux-kernel

Eric Sesterhenn wrote:
> hi,
> 
> gcc 4.1 with some extra warnings show the following:
> 
> drivers/scsi/ipr.c:6361: warning: comparison of unsigned expression < 0 is always false
> drivers/scsi/ipr.c:6385: warning: comparison of unsigned expression < 0 is always false
> drivers/scsi/ipr.c:6415: warning: comparison of unsigned expression < 0 is always false

Acked-by: Brian King <brking@us.ibm.com>

> 
> The problem is that rc is of the type u32, which can never be smaller than zero,
> therefore all three error handling checks get useless. This patch changes it to
> a normal int, because all usages / all functions it get used with expect an int.
> 
> Signed-off-by: Eric Sesterhenn <snakebyte@gmx.de>
> 
> --- linux-2.6.18-rc4/drivers/scsi/ipr.c.orig	2006-08-19 21:10:18.000000000 +0200
> +++ linux-2.6.18-rc4/drivers/scsi/ipr.c	2006-08-19 21:10:25.000000000 +0200
> @@ -6324,7 +6324,7 @@ static int __devinit ipr_probe_ioa(struc
>  	struct Scsi_Host *host;
>  	unsigned long ipr_regs_pci;
>  	void __iomem *ipr_regs;
> -	u32 rc = PCIBIOS_SUCCESSFUL;
> +	int rc = PCIBIOS_SUCCESSFUL;
>  	volatile u32 mask, uproc;
>  
>  	ENTER;
> 
> 


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2006-08-20 18:57 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-08-19 19:13 [Patch] Signedness issue in drivers/scsi/ipr.c Eric Sesterhenn
2006-08-20 18:20 ` Alan Cox
2006-08-20 18:56 ` Brian King

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox