diff options
author | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2012-04-24 05:29:42 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2012-05-07 11:56:36 -0400 |
commit | 1cb1976ecd018b02825e5a0fba06ffe95bdaedc6 (patch) | |
tree | 188ae6313e230d6e2d3d946168d4d8bcde1a9346 /drivers/usb/gadget | |
parent | 06200304e7eb237015f433bd8884975e93aba1f5 (diff) |
usb gadget: uvc: uvc_request_data::length field must be signed
commit 6f6543f53f9ce136e01d7114bf6f0818ca54fb41 upstream.
The field is used to pass the UVC request data length, but can also be
used to signal an error when setting it to a negative value. Switch from
unsigned int to __s32.
Reported-by: Fernandez Gonzalo <gfernandez@copreci.es>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb/gadget')
-rw-r--r-- | drivers/usb/gadget/uvc.h | 2 | ||||
-rw-r--r-- | drivers/usb/gadget/uvc_v4l2.c | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/drivers/usb/gadget/uvc.h b/drivers/usb/gadget/uvc.h index 5b7919460fd..01a23c1197f 100644 --- a/drivers/usb/gadget/uvc.h +++ b/drivers/usb/gadget/uvc.h | |||
@@ -29,7 +29,7 @@ | |||
29 | 29 | ||
30 | struct uvc_request_data | 30 | struct uvc_request_data |
31 | { | 31 | { |
32 | unsigned int length; | 32 | __s32 length; |
33 | __u8 data[60]; | 33 | __u8 data[60]; |
34 | }; | 34 | }; |
35 | 35 | ||
diff --git a/drivers/usb/gadget/uvc_v4l2.c b/drivers/usb/gadget/uvc_v4l2.c index 5e807f083bc..992f66b88c8 100644 --- a/drivers/usb/gadget/uvc_v4l2.c +++ b/drivers/usb/gadget/uvc_v4l2.c | |||
@@ -41,7 +41,7 @@ uvc_send_response(struct uvc_device *uvc, struct uvc_request_data *data) | |||
41 | if (data->length < 0) | 41 | if (data->length < 0) |
42 | return usb_ep_set_halt(cdev->gadget->ep0); | 42 | return usb_ep_set_halt(cdev->gadget->ep0); |
43 | 43 | ||
44 | req->length = min(uvc->event_length, data->length); | 44 | req->length = min_t(unsigned int, uvc->event_length, data->length); |
45 | req->zero = data->length < uvc->event_length; | 45 | req->zero = data->length < uvc->event_length; |
46 | req->dma = DMA_ADDR_INVALID; | 46 | req->dma = DMA_ADDR_INVALID; |
47 | 47 | ||