* [patch] usb: gadget: f_uac1: silence an info leak warning
@ 2013-02-28 4:43 Dan Carpenter
0 siblings, 0 replies; only message in thread
From: Dan Carpenter @ 2013-02-28 4:43 UTC (permalink / raw)
To: kernel-janitors
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).
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
Static checker fix. I can't test this.
diff --git a/drivers/usb/gadget/f_uac1.c b/drivers/usb/gadget/f_uac1.c
index f570e66..fa8ea4e 100644
--- a/drivers/usb/gadget/f_uac1.c
+++ b/drivers/usb/gadget/f_uac1.c
@@ -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;
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2013-02-28 4:43 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-02-28 4:43 [patch] usb: gadget: f_uac1: silence an info leak warning Dan Carpenter
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox