+ usb-negative-index-in-drivers-usb-host-isp116x-hcdc.patch added to -mm tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The patch titled

     usb: negative index in drivers/usb/host/isp116x-hcd.c

has been added to the -mm tree.  Its filename is

     usb-negative-index-in-drivers-usb-host-isp116x-hcdc.patch

See http://www.zip.com.au/~akpm/linux/patches/stuff/added-to-mm.txt to find
out what to do about this

------------------------------------------------------
Subject: usb: negative index in drivers/usb/host/isp116x-hcd.c
From: Eric Sesterhenn <snakebyte@xxxxxx>


This fixes coverity Bug #390.

With the following code

	ret = ep->branch = balance(isp116x, ep->period, ep->load);
	if (ret < 0)
		goto fail;

the problem is that ret and balance are of the type int, and ep->branch is u16.
so the int balance() returns gets reduced to u16 and then converted to an int again,
which removes the sign. Maybe the following little c program can explain it better:

----snip----
int foo() {
	return -5;
}

int main(int argc, char **argv) {
	int a;
	unsigned short b;

	a = b = foo();
	if (a < 0)
		puts("case 1 works\n");

	b = a = foo();
	if (a < 0 )
		puts("case 2 works\n");
}
----snip----

only the case 2 output is visible.

Signed-off-by: Eric Sesterhenn <snakebyte@xxxxxx>
Signed-off-by: Andrew Morton <akpm@xxxxxxxx>
---

 drivers/usb/host/isp116x-hcd.c |    2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)

diff -puN drivers/usb/host/isp116x-hcd.c~usb-negative-index-in-drivers-usb-host-isp116x-hcdc drivers/usb/host/isp116x-hcd.c
--- 25/drivers/usb/host/isp116x-hcd.c~usb-negative-index-in-drivers-usb-host-isp116x-hcdc	Wed May 31 16:14:46 2006
+++ 25-akpm/drivers/usb/host/isp116x-hcd.c	Wed May 31 16:14:46 2006
@@ -781,7 +781,7 @@ static int isp116x_urb_enqueue(struct us
 		if (ep->branch < PERIODIC_SIZE)
 			break;
 
-		ret = ep->branch = balance(isp116x, ep->period, ep->load);
+		ep->branch = ret = balance(isp116x, ep->period, ep->load);
 		if (ret < 0)
 			goto fail;
 		ret = 0;
_

Patches currently in -mm which might be from snakebyte@xxxxxx are

git-alsa.patch
git-gfs2.patch
usb-negative-index-in-drivers-usb-host-isp116x-hcdc.patch
more-bug_on-conversion.patch

-
To unsubscribe from this list: send the line "unsubscribe mm-commits" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Kernel Newbies FAQ]     [Kernel Archive]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Photo]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]

  Powered by Linux