]> rtime.felk.cvut.cz Git - linux-imx.git/commitdiff
usb: gadget: f_uac1: silence an info leak warning
authorDan Carpenter <dan.carpenter@oracle.com>
Thu, 28 Feb 2013 04:43:12 +0000 (07:43 +0300)
committerFelipe Balbi <balbi@ti.com>
Mon, 4 Mar 2013 11:13:58 +0000 (13:13 +0200)
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>
drivers/usb/gadget/f_uac1.c

index f570e667a640d0619cd6abaffaf9705738fcab24..fa8ea4ea00c1a3014be0fdc35dfcc52bb17af166 100644 (file)
@@ -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;