Skip to content

Commit

Permalink
usb: gadget: f_uac1: silence an info leak warning
Browse files Browse the repository at this point in the history
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>
Signed-off-by: Felipe Balbi <balbi@ti.com>
  • Loading branch information
Dan Carpenter authored and Felipe Balbi committed Mar 4, 2013
1 parent 57ae575 commit fddedd8
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions drivers/usb/gadget/f_uac1.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit fddedd8

Please sign in to comment.