[media] go7007: fix invalid use of sizeof in go7007_usb_i2c_master_xfer()
authorWei Yongjun <yongjun_wei@trendmicro.com.cn>
Tue, 26 Mar 2013 07:45:11 +0000 (04:45 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Tue, 26 Mar 2013 11:37:46 +0000 (08:37 -0300)
sizeof() when applied to a pointer typed expression gives the
size of the pointer, not that of the pointed data.

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/staging/media/go7007/go7007-usb.c

index a734ead8fc64f8ac145cb9d60eacb73e78778087..50066e01a6edd1e86caccb9b2bd937ec97c6bea1 100644 (file)
@@ -1037,7 +1037,7 @@ static int go7007_usb_i2c_master_xfer(struct i2c_adapter *adapter,
                                                buf, buf_len, 0) < 0)
                        goto i2c_done;
                if (msgs[i].flags & I2C_M_RD) {
-                       memset(buf, 0, sizeof(buf));
+                       memset(buf, 0, msgs[i].len + 1);
                        if (go7007_usb_vendor_request(go, 0x25, 0, 0, buf,
                                                msgs[i].len + 1, 1) < 0)
                                goto i2c_done;