public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
* [patch 21/28] Signedness issue in drivers/scsi/ipr.c
@ 2006-09-25 23:59 akpm
  2006-09-26 13:10 ` Brian King
  0 siblings, 1 reply; 2+ messages in thread
From: akpm @ 2006-09-25 23:59 UTC (permalink / raw)
  To: James.Bottomley; +Cc: linux-scsi, akpm, snakebyte, brking

From: Eric Sesterhenn <snakebyte@gmx.de>

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>
Cc: James Bottomley <James.Bottomley@steeleye.com>
Cc: Brian King <brking@us.ibm.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
---

 drivers/scsi/ipr.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff -puN drivers/scsi/ipr.c~signedness-issue-in-drivers-scsi-iprc drivers/scsi/ipr.c
--- a/drivers/scsi/ipr.c~signedness-issue-in-drivers-scsi-iprc
+++ a/drivers/scsi/ipr.c
@@ -6352,7 +6352,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] 2+ messages in thread

* Re: [patch 21/28] Signedness issue in drivers/scsi/ipr.c
  2006-09-25 23:59 [patch 21/28] Signedness issue in drivers/scsi/ipr.c akpm
@ 2006-09-26 13:10 ` Brian King
  0 siblings, 0 replies; 2+ messages in thread
From: Brian King @ 2006-09-26 13:10 UTC (permalink / raw)
  To: akpm; +Cc: James.Bottomley, linux-scsi, snakebyte

ACK

akpm@osdl.org wrote:
> From: Eric Sesterhenn <snakebyte@gmx.de>
> 
> 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>
> Cc: James Bottomley <James.Bottomley@steeleye.com>
> Cc: Brian King <brking@us.ibm.com>
> Signed-off-by: Andrew Morton <akpm@osdl.org>
> ---
> 
>  drivers/scsi/ipr.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff -puN drivers/scsi/ipr.c~signedness-issue-in-drivers-scsi-iprc drivers/scsi/ipr.c
> --- a/drivers/scsi/ipr.c~signedness-issue-in-drivers-scsi-iprc
> +++ a/drivers/scsi/ipr.c
> @@ -6352,7 +6352,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;
> _
> -
> To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html


-- 
Brian King
eServer Storage I/O
IBM Linux Technology Center

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

end of thread, other threads:[~2006-09-26 13:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-09-25 23:59 [patch 21/28] Signedness issue in drivers/scsi/ipr.c akpm
2006-09-26 13:10 ` Brian King

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