提交 b5ae1146 编写于 作者: K Kumar Amit Mehta 提交者: Greg Kroah-Hartman

staging: comedi: drivers: usbduxsigma.c: fix DMA buffers on stack

This patch fixes an instance of DMA buffer on stack(being passed to
usb_control_msg)for the USB-DUXsigma Board driver. Found using smatch.
Signed-off-by: NKumar Amit Mehta <gmate.amit@gmail.com>
Reviewed-by: NDan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: NIan Abbott <abbotti@mev.co.uk>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
上级 47b1be5c
......@@ -681,7 +681,11 @@ static void usbduxsub_ao_IsocIrq(struct urb *urb)
static int usbduxsub_start(struct usbduxsub *usbduxsub)
{
int errcode = 0;
uint8_t local_transfer_buffer[16];
uint8_t *local_transfer_buffer;
local_transfer_buffer = kmalloc(16, GFP_KERNEL);
if (!local_transfer_buffer)
return -ENOMEM;
/* 7f92 to zero */
local_transfer_buffer[0] = 0;
......@@ -702,19 +706,22 @@ static int usbduxsub_start(struct usbduxsub *usbduxsub)
1,
/* Timeout */
BULK_TIMEOUT);
if (errcode < 0) {
if (errcode < 0)
dev_err(&usbduxsub->interface->dev,
"comedi_: control msg failed (start)\n");
return errcode;
}
return 0;
kfree(local_transfer_buffer);
return errcode;
}
static int usbduxsub_stop(struct usbduxsub *usbduxsub)
{
int errcode = 0;
uint8_t *local_transfer_buffer;
uint8_t local_transfer_buffer[16];
local_transfer_buffer = kmalloc(16, GFP_KERNEL);
if (!local_transfer_buffer)
return -ENOMEM;
/* 7f92 to one */
local_transfer_buffer[0] = 1;
......@@ -732,12 +739,12 @@ static int usbduxsub_stop(struct usbduxsub *usbduxsub)
1,
/* Timeout */
BULK_TIMEOUT);
if (errcode < 0) {
if (errcode < 0)
dev_err(&usbduxsub->interface->dev,
"comedi_: control msg failed (stop)\n");
return errcode;
}
return 0;
kfree(local_transfer_buffer);
return errcode;
}
static int usbduxsub_upload(struct usbduxsub *usbduxsub,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册