All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] USB: legousbtower: fix a signedness bug in tower_probe()
@ 2019-10-11 13:35 ` Dan Carpenter
  0 siblings, 0 replies; 14+ messages in thread
From: Dan Carpenter @ 2019-10-11 13:35 UTC (permalink / raw)
  To: Juergen Stuber, Johan Hovold
  Cc: Greg Kroah-Hartman, legousb-devel, linux-usb, kernel-janitors

The problem is that sizeof() is unsigned long so negative error codes
are type promoted to high positive values and the condition becomes
false.

Fixes: 1d427be4a39d ("USB: legousbtower: fix slab info leak at probe")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
 drivers/usb/misc/legousbtower.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/misc/legousbtower.c b/drivers/usb/misc/legousbtower.c
index 9d4c52a7ebe0..835908fe1e65 100644
--- a/drivers/usb/misc/legousbtower.c
+++ b/drivers/usb/misc/legousbtower.c
@@ -881,7 +881,7 @@ static int tower_probe (struct usb_interface *interface, const struct usb_device
 				  get_version_reply,
 				  sizeof(*get_version_reply),
 				  1000);
-	if (result < sizeof(*get_version_reply)) {
+	if (result < 0 || result < sizeof(*get_version_reply)) {
 		if (result >= 0)
 			result = -EIO;
 		dev_err(idev, "get version request failed: %d\n", result);
-- 
2.20.1

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

end of thread, other threads:[~2019-10-11 14:23 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-11 13:35 [PATCH] USB: legousbtower: fix a signedness bug in tower_probe() Dan Carpenter
2019-10-11 13:35 ` Dan Carpenter
2019-10-11 13:51 ` walter harms
2019-10-11 13:51   ` walter harms
2019-10-11 13:58   ` Dan Carpenter
2019-10-11 13:58     ` Dan Carpenter
2019-10-11 14:08     ` Johan Hovold
2019-10-11 14:08       ` Johan Hovold
2019-10-11 14:11   ` [PATCH v2] " Dan Carpenter
2019-10-11 14:11     ` Dan Carpenter
2019-10-11 14:23     ` Johan Hovold
2019-10-11 14:23       ` Johan Hovold
2019-10-11 14:04 ` [PATCH] " Johan Hovold
2019-10-11 14:04   ` Johan Hovold

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.