projects
/
linux.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
fb4e98a
)
USB: usbtest: prevent a divide by zero bug
author
Dan Carpenter
<dan.carpenter@oracle.com>
Sat, 17 Nov 2012 15:06:11 +0000
(18:06 +0300)
committer
Greg Kroah-Hartman
<gregkh@linuxfoundation.org>
Wed, 21 Nov 2012 21:32:26 +0000
(13:32 -0800)
If param->length is zero, then this could lead to a divide by zero bug
later in the function when we do: size %= max;
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/misc/usbtest.c
patch
|
blob
|
history
diff --git
a/drivers/usb/misc/usbtest.c
b/drivers/usb/misc/usbtest.c
index
f10bd97
..
7667b12
100644
(file)
--- a/
drivers/usb/misc/usbtest.c
+++ b/
drivers/usb/misc/usbtest.c
@@
-423,6
+423,9
@@
alloc_sglist(int nents, int max, int vary)
unsigned i;
unsigned size = max;
+ if (max == 0)
+ return NULL;
+
sg = kmalloc_array(nents, sizeof *sg, GFP_KERNEL);
if (!sg)
return NULL;