Skip to contentSkip to conversation

usb: gadget: f_uac1: silence an info leak warning

PATCH New Dan Carpenter 1 participant 1 message Feb 28, 2013

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

PATCH 1/1 usb: gadget: f_uac1: silence an info leak warning

Smatch complains that "len" could be larger than the sizeof(value) so we could be copying garbage here. I have changed this to match how things are done in composite_setup().

The call tree looks like:
composite_setup()
--> f_audio_setup()

      --> audio_get_intf_req()

composite_setup() expects the return value to be set to sizeof(value).

---
Static checker fix. I can't test this.

drivers/usb/gadget/f_uac1.c +1 -0
index f570e66..fa8ea4e 100644
@@ -418,6 +418,7 @@ static int audio_get_intf_req(struct usb_function *f,
 
 	req->context = audio;
 	req->complete = f_audio_complete;
+	len = min_t(size_t, sizeof(value), len);
 	memcpy(req->buf, &value, len);
 
 	return len;