Skip to content

Commit

Permalink
usb gadget: uvc: uvc_request_data::length field must be signed
Browse files Browse the repository at this point in the history
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>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Laurent Pinchart authored and Greg Kroah-Hartman committed Apr 24, 2012
1 parent 66f75a5 commit 6f6543f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion drivers/usb/gadget/uvc.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

struct uvc_request_data
{
unsigned int length;
__s32 length;
__u8 data[60];
};

Expand Down
2 changes: 1 addition & 1 deletion drivers/usb/gadget/uvc_v4l2.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ uvc_send_response(struct uvc_device *uvc, struct uvc_request_data *data)
if (data->length < 0)
return usb_ep_set_halt(cdev->gadget->ep0);

req->length = min(uvc->event_length, data->length);
req->length = min_t(unsigned int, uvc->event_length, data->length);
req->zero = data->length < uvc->event_length;
req->dma = DMA_ADDR_INVALID;

Expand Down

0 comments on commit 6f6543f

Please sign in to comment.