]> git.baikalelectronics.ru Git - kernel.git/commit
[PATCH] USB: negative index in drivers/usb/host/isp116x-hcd.c
authorEric Sesterhenn <snakebyte@gmx.de>
Fri, 2 Jun 2006 03:48:45 +0000 (20:48 -0700)
committerGreg Kroah-Hartman <gregkh@suse.de>
Wed, 21 Jun 2006 22:04:15 +0000 (15:04 -0700)
commit7776fc1458bbcf3a4d80b721af1b42f879bc6a7f
tree35920fe3fd457b4a472dfa999b76393637d2d544
parente9e2fa3670c4f13597d7fc67ff225136e33a07e6
[PATCH] USB: negative index in drivers/usb/host/isp116x-hcd.c

From: Eric Sesterhenn <snakebyte@gmx.de>

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:
drivers/usb/host/isp116x-hcd.c