Skip to contentSkip to conversation

usb gadget: uvc: use capped length value

PATCH In review Dan Carpenter 3 participants 3 messages Mar 14, 2013

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 usb gadget: uvc: use capped length value

"req->length" is a capped version of "data->length".

---
Static analysis. I have not tested this.

drivers/usb/gadget/uvc_v4l2.c +1 -1
index 2ca9386..8770cf0 100644
@@ -43,7 +43,7 @@ uvc_send_response(struct uvc_device *uvc, struct uvc_request_data *data)
 	req->zero = data->length < uvc->event_length;
 	req->dma = DMA_ADDR_INVALID;
 
-	memcpy(req->buf, data->data, data->length);
+	memcpy(req->buf, data->data, req->length);
 
 	return usb_ep_queue(cdev->gadget->ep0, req, GFP_KERNEL);
 }
Acked-by on v1 1/1
#1 lore raw

Hi Dan,

Thanks for the patch.

Quoted 3 lines · On Thursday 14 March 2013 11:01:05 Dan Carpenter wrote:

"req->length" is a capped version of "data->length".

Good catch.

Felipe, could you please pick this one up (I can of course send you a pull request if preferred) ?

Quoted 16 lines

---
Static analysis. I have not tested this.

drivers/usb/gadget/uvc_v4l2.c +1 -1
index 2ca9386..8770cf0 100644
@@ -43,7 +43,7 @@ uvc_send_response(struct uvc_device *uvc, struct
 uvc_request_data *data) req->zero = data->length < uvc->event_length;
 	req->dma = DMA_ADDR_INVALID;
 
-	memcpy(req->buf, data->data, data->length);
+	memcpy(req->buf, data->data, req->length);
 
 	return usb_ep_queue(cdev->gadget->ep0, req, GFP_KERNEL);
 }
Signature · 3 lines
Regards,

Laurent Pinchart
#2 lore raw
In reply to Dan Carpenter
Quoted 7 lines · Laurent Pinchart

Hi Dan,

Thanks for the patch.

Quoted 2 lines · On Thursday 14 March 2013 11:01:05 Dan Carpenter wrote:

"req->length" is a capped version of "data->length".

Quoted 8 lines
Quoted 1 line

Good catch.

Felipe, could you please pick this one up (I can of course send you a pull request if preferred) ?

sure thing, no need to worry with building a branch ;-)

Signature · 1 line
balbi