Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[media] usbvision: fix DMA from stack warnings

In various places the stack was used to provide buffers for USB data, but
this should be allocated memory.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>

authored by

Hans Verkuil and committed by
Mauro Carvalho Chehab
8926e845 e2c84ccb

+11 -9
+10 -8
drivers/media/usb/usbvision/usbvision-core.c
··· 1367 1367 int usbvision_read_reg(struct usb_usbvision *usbvision, unsigned char reg) 1368 1368 { 1369 1369 int err_code = 0; 1370 - unsigned char buffer[1]; 1370 + unsigned char *buffer = usbvision->ctrl_urb_buffer; 1371 1371 1372 1372 if (!USBVISION_IS_OPERATIONAL(usbvision)) 1373 1373 return -1; ··· 1401 1401 if (!USBVISION_IS_OPERATIONAL(usbvision)) 1402 1402 return 0; 1403 1403 1404 + usbvision->ctrl_urb_buffer[0] = value; 1404 1405 err_code = usb_control_msg(usbvision->dev, usb_sndctrlpipe(usbvision->dev, 1), 1405 1406 USBVISION_OP_CODE, 1406 1407 USB_DIR_OUT | USB_TYPE_VENDOR | 1407 - USB_RECIP_ENDPOINT, 0, (__u16) reg, &value, 1, HZ); 1408 + USB_RECIP_ENDPOINT, 0, (__u16) reg, 1409 + usbvision->ctrl_urb_buffer, 1, HZ); 1408 1410 1409 1411 if (err_code < 0) { 1410 1412 dev_err(&usbvision->dev->dev, ··· 1598 1596 { 0x27, 0x00, 0x00 }, { 0x28, 0x00, 0x00 }, { 0x29, 0x00, 0x00 }, { 0x08, 0x80, 0x60 }, 1599 1597 { 0x0f, 0x2d, 0x24 }, { 0x0c, 0x80, 0x80 } 1600 1598 }; 1601 - char value[3]; 1599 + unsigned char *value = usbvision->ctrl_urb_buffer; 1602 1600 1603 1601 /* the only difference between PAL and NTSC init_values */ 1604 1602 if (usbvision_device_data[usbvision->dev_model].video_norm == V4L2_STD_NTSC) ··· 1637 1635 static int usbvision_set_video_format(struct usb_usbvision *usbvision, int format) 1638 1636 { 1639 1637 static const char proc[] = "usbvision_set_video_format"; 1638 + unsigned char *value = usbvision->ctrl_urb_buffer; 1640 1639 int rc; 1641 - unsigned char value[2]; 1642 1640 1643 1641 if (!USBVISION_IS_OPERATIONAL(usbvision)) 1644 1642 return 0; ··· 1679 1677 int err_code = 0; 1680 1678 int usb_width, usb_height; 1681 1679 unsigned int frame_rate = 0, frame_drop = 0; 1682 - unsigned char value[4]; 1680 + unsigned char *value = usbvision->ctrl_urb_buffer; 1683 1681 1684 1682 if (!USBVISION_IS_OPERATIONAL(usbvision)) 1685 1683 return 0; ··· 1874 1872 { 1875 1873 static const char proc[] = "usbvision_set_compresion_params: "; 1876 1874 int rc; 1877 - unsigned char value[6]; 1875 + unsigned char *value = usbvision->ctrl_urb_buffer; 1878 1876 1879 1877 value[0] = 0x0F; /* Intra-Compression cycle */ 1880 1878 value[1] = 0x01; /* Reg.45 one line per strip */ ··· 1948 1946 { 1949 1947 static const char proc[] = "usbvision_set_input: "; 1950 1948 int rc; 1951 - unsigned char value[8]; 1949 + unsigned char *value = usbvision->ctrl_urb_buffer; 1952 1950 unsigned char dvi_yuv_value; 1953 1951 1954 1952 if (!USBVISION_IS_OPERATIONAL(usbvision)) ··· 2064 2062 2065 2063 static int usbvision_set_dram_settings(struct usb_usbvision *usbvision) 2066 2064 { 2065 + unsigned char *value = usbvision->ctrl_urb_buffer; 2067 2066 int rc; 2068 - unsigned char value[8]; 2069 2067 2070 2068 if (usbvision->isoc_mode == ISOC_MODE_COMPRESS) { 2071 2069 value[0] = 0x42;
+1 -1
drivers/media/usb/usbvision/usbvision-i2c.c
··· 343 343 { 344 344 int rc, retries; 345 345 int i; 346 - unsigned char value[6]; 346 + unsigned char *value = usbvision->ctrl_urb_buffer; 347 347 unsigned char ser_cont; 348 348 349 349 ser_cont = (len & 0x07) | 0x10;