Skip to content

Commit fddedd8

Browse files
Dan CarpenterFelipe Balbi
authored andcommitted
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). Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
1 parent 57ae575 commit fddedd8

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

‎drivers/usb/gadget/f_uac1.c‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -418,6 +418,7 @@ static int audio_get_intf_req(struct usb_function *f,
418418

419419
req->context = audio;
420420
req->complete = f_audio_complete;
421+
len = min_t(size_t, sizeof(value), len);
421422
memcpy(req->buf, &value, len);
422423

423424
return len;

0 commit comments

Comments
 (0)