public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* 2.4.21-pre4 comparison bugs
@ 2003-02-08 17:18 Oleg Drokin
  2003-02-08 23:25 ` J.A. Magallon
                   ` (2 more replies)
  0 siblings, 3 replies; 12+ messages in thread
From: Oleg Drokin @ 2003-02-08 17:18 UTC (permalink / raw)
  To: alan, linux-kernel

Hello!

   Thanks to whoever mentioned "gcc -W", it's *sweet*  ;)
   Looking at it's output I found few cases where error checking
   does not work.
   Though nothing too serious it seems (except maybe IDE setup-pci stuff,
   I just do not know about that, and may be in that case
   we actually want to change all the functions to return signed
   value, though my fix is certainly less intrusive ;) )
   Most of the patched stuff in here assigns signed value to unsigned
   variable and then checks if it is less than zero which does not work
   for obvious reasons ;)
   I decided taht in most cases simple casting to int would be best
   and least intrusive resolution of a problem.
   The only exception is fs/isofs/inode.c, there we have unsigned int
   (so it is unsigned not depending on any arch) and so '> some num'
   stuff will also check for former negative numbers anyway. So
   I removed one extra comparison in that case.
   See the patch below.

Bye,
    Oleg

===== drivers/ide/setup-pci.c 1.2 vs edited =====
--- 1.2/drivers/ide/setup-pci.c	Thu Dec 12 04:09:23 2002
+++ edited/drivers/ide/setup-pci.c	Sat Feb  8 19:06:13 2003
@@ -582,7 +582,7 @@
 
 	index.all = 0xf0f0;
 
-	if((autodma = ide_setup_pci_controller(dev, d, noisy, &tried_config)) < 0)
+	if((int)(autodma = ide_setup_pci_controller(dev, d, noisy, &tried_config)) < 0)
 		return index;
 
 	/*
@@ -613,7 +613,7 @@
 	} else {
 		if (d->init_chipset)
 		{
-			if(d->init_chipset(dev, d->name) < 0)
+			if((int)d->init_chipset(dev, d->name) < 0)
 				return index;
 		}
 		if (noisy)
===== drivers/net/tun.c 1.8 vs edited =====
--- 1.8/drivers/net/tun.c	Mon Apr 22 21:38:08 2002
+++ edited/drivers/net/tun.c	Sat Feb  8 19:07:28 2003
@@ -188,7 +188,7 @@
 	size_t len = count;
 
 	if (!(tun->flags & TUN_NO_PI)) {
-		if ((len -= sizeof(pi)) < 0)
+		if ((int)(len -= sizeof(pi)) < 0)
 			return -EINVAL;
 
 		memcpy_fromiovec((void *)&pi, iv, sizeof(pi));
===== fs/isofs/inode.c 1.9 vs edited =====
--- 1.9/fs/isofs/inode.c	Mon Jul  1 02:25:33 2002
+++ edited/fs/isofs/inode.c	Sat Feb  8 19:15:41 2003
@@ -343,13 +343,13 @@
 		if (!strcmp(this_char,"session") && value) {
 			char * vpnt = value;
 			unsigned int ivalue = simple_strtoul(vpnt, &vpnt, 0);
-			if(ivalue < 0 || ivalue >99) return 0;
+			if(ivalue > 99) return 0;
 			popt->session=ivalue+1;
 		}
 		if (!strcmp(this_char,"sbsector") && value) {
 			char * vpnt = value;
 			unsigned int ivalue = simple_strtoul(vpnt, &vpnt, 0);
-			if(ivalue < 0 || ivalue >660*512) return 0;
+			if(ivalue > 660*512) return 0;
 			popt->sbsector=ivalue;
 		}
 		else if (!strcmp(this_char,"check") && value) {
===== net/sunrpc/pmap_clnt.c 1.3 vs edited =====
--- 1.3/net/sunrpc/pmap_clnt.c	Wed Apr 24 12:58:19 2002
+++ edited/net/sunrpc/pmap_clnt.c	Sat Feb  8 19:09:20 2003
@@ -149,7 +149,7 @@
 	struct sockaddr_in	sin;
 	struct rpc_portmap	map;
 	struct rpc_clnt		*pmap_clnt;
-	unsigned int		error = 0;
+	int			error = 0;
 
 	dprintk("RPC: registering (%d, %d, %d, %d) with portmapper.\n",
 			prog, vers, prot, port);

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

end of thread, other threads:[~2003-02-17  2:03 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-02-08 17:18 2.4.21-pre4 comparison bugs Oleg Drokin
2003-02-08 23:25 ` J.A. Magallon
2003-02-17  2:10   ` Bill Davidsen
2003-02-09  0:58 ` Alan Cox
2003-02-09 17:53   ` 2.4.21-pre4 comparison bugs (More of those) Oleg Drokin
2003-02-09 18:22     ` 2.4.21-pre4 comparison bugs (Even More Again) Oleg Drokin
2003-02-09 21:59       ` Alan Cox
2003-02-09 22:01     ` 2.4.21-pre4 comparison bugs (More of those) Alan Cox
2003-02-10  7:06       ` Oleg Drokin
2003-02-09 16:54 ` 2.4.21-pre4 more extra semicolons bugs Oleg Drokin
2003-02-09 16:59   ` 2.4.21-pre4 - two simple compile fixes Oleg Drokin
2003-02-09 22:02     ` Alan Cox

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