linux-stable/drivers/usb/wusbcore
Julia Lawall ad04608260 usb: wusbcore: security: cast sizeof to int for comparison
[ Upstream commit d3ac5598c5 ]

Comparing an int to a size, which is unsigned, causes the int to become
unsigned, giving the wrong result.  usb_get_descriptor can return a
negative error code.

A simplified version of the semantic match that finds this problem is as
follows: (http://coccinelle.lip6.fr/)

// <smpl>
@@
int x;
expression e,e1;
identifier f;
@@

*x = f(...);
... when != x = e1
    when != if (x < 0 || ...) { ... return ...; }
*x < sizeof(e)
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-10-03 17:01:45 -07:00
..
cbaf.c USB: wusbcore: add in missing white space in error message text 2016-09-13 17:24:24 +02:00
crypto.c wusbcore: Fix one more crypto-on-the-stack bug 2017-01-19 20:18:01 +01:00
dev-sysfs.c
devconnect.c usb: wusbcore: remove unreachable code 2016-04-19 04:33:15 +09:00
Kconfig
Makefile
mmc.c
pal.c
reservation.c
rh.c
security.c usb: wusbcore: security: cast sizeof to int for comparison 2018-10-03 17:01:45 -07:00
wa-hc.c USB: wusbcore: fix NULL-deref at probe 2017-03-30 09:41:24 +02:00
wa-hc.h
wa-nep.c usb: wusbcore: wa-nep: don't print on ENOMEM 2016-08-30 19:17:39 +02:00
wa-rpipe.c
wa-xfer.c usb: wusbcore: wa-xfer: don't print error when allocating urb fails 2016-08-15 15:54:27 +02:00
wusbhc.c
wusbhc.h