Commit c53439fb authored by Tobin C. Harding's avatar Tobin C. Harding Committed by Greg Kroah-Hartman

usb: usbtest: Remove stack VLA usage

The kernel would like to have all stack VLA usage removed[1].  We
already have a pre-processor constant defined MAX_SGLEN.  We can use
this instead of the variable param-sglen.

[1]: https://lkml.org/lkml/2018/3/7/621Signed-off-by: default avatarTobin C. Harding <me@tobin.cc>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent cc9debf8
......@@ -2028,11 +2028,14 @@ test_queue(struct usbtest_dev *dev, struct usbtest_param_32 *param,
unsigned i;
unsigned long packets = 0;
int status = 0;
struct urb *urbs[param->sglen];
struct urb *urbs[MAX_SGLEN];
if (!param->sglen || param->iterations > UINT_MAX / param->sglen)
return -EINVAL;
if (param->sglen > MAX_SGLEN)
return -EINVAL;
memset(&context, 0, sizeof(context));
context.count = param->iterations * param->sglen;
context.dev = dev;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment