提交 564e6989 编写于 作者: D Dan Carpenter 提交者: Greg Kroah-Hartman

USB: usbtest: prevent a divide by zero bug

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: NDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
上级 fb4e98ab
......@@ -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;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册