1
0
Fork 0
remarkable-linux/drivers/usb/wusbcore
Julia Lawall 149f530334 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:00:49 -07:00
..
Kconfig usb: wusbcore: USB_WUSB_CBAF depends on USB 2014-09-23 22:06:33 -07:00
Makefile License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
cbaf.c usb: wusbcore: cbaf: constify attribute_group structures. 2017-08-10 11:31:27 -07:00
crypto.c wusbcore: Fix one more crypto-on-the-stack bug 2017-01-10 17:03:42 +01:00
dev-sysfs.c usb: wusbcore: dev-sysfs: constify attribute_group structures. 2017-08-10 11:31:27 -07:00
devconnect.c usb: wusbcore: remove unreachable code 2016-04-19 04:33:15 +09:00
mmc.c usb: wusbcore: fix panic in wusbhc_chid_set 2014-04-24 12:45:41 -07:00
pal.c usb: wusbcore: add debug prints to reservation and channel change 2013-12-20 12:06:46 -08:00
reservation.c usb: use %*pb[l] to print bitmaps including cpumasks and nodemasks 2015-02-13 21:21:38 -08:00
rh.c wusbcore: rh: use USB_DT_HUB 2015-04-03 19:03:15 +02:00
security.c usb: wusbcore: security: cast sizeof to int for comparison 2018-10-03 17:00:49 -07:00
wa-hc.c USB: wusbcore: fix NULL-deref at probe 2017-03-14 17:07:30 +08:00
wa-hc.h usb: hub: rename khubd to hub_wq in documentation and comments 2014-09-23 22:33:19 -07:00
wa-nep.c usb: fix improper return value when kzalloc fails 2016-11-29 17:36:43 +01:00
wa-rpipe.c usb: use %*pb[l] to print bitmaps including cpumasks and nodemasks 2015-02-13 21:21:38 -08:00
wa-xfer.c usb: return correct errno on failures 2016-11-29 17:36:43 +01:00
wusbhc.c usb: wusbcore: wusbhc: constify attribute_group structures. 2017-08-10 11:31:27 -07:00
wusbhc.h USB: core, wusbcore: use bus_to_hcd 2016-01-24 21:00:33 -08:00