From patchwork Tue Mar 26 08:45:11 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Yongjun X-Patchwork-Id: 2335231 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 4F6393FC54 for ; Tue, 26 Mar 2013 08:45:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755903Ab3CZIpN (ORCPT ); Tue, 26 Mar 2013 04:45:13 -0400 Received: from mail-bk0-f52.google.com ([209.85.214.52]:52929 "EHLO mail-bk0-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753591Ab3CZIpM (ORCPT ); Tue, 26 Mar 2013 04:45:12 -0400 Received: by mail-bk0-f52.google.com with SMTP id it16so797131bkc.25 for ; Tue, 26 Mar 2013 01:45:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:date:message-id:subject:from:to:cc :content-type; bh=bngDAjHS+hYYnOB+bnP/AuTjThY6yaRxvvmZdsJ3lT8=; b=HREYe+4EdkVXspMywpUzr11SfdPrRN7L/WpGKJIFmJ6bSYkUPoGUyOo53j5G6nwvdp 7DIoNG3MginwQqIYc20ycg61GyIKJvKj+0oBdLO5MvcfJFkbOkZSdJA3QEU+EN0VaNmq 8Yx0gNaye3fgZPtkKlMZw9u+SKYD9WJyah7DvSOpHLIZTaLTtcfuXmEGFDcgydFQJo2B 5E/Bb0Q+hBH5HAmvhdem3awqVsJsV2rHk6WQvubTYhiKdSoFBZBKewa7tx6GeC1wY+VS e1kyH7hZqEk5WwfO0Gy6K2PxXib4+yL95pDEhvNWBhk8ICXtQK/Pa5B3hUGnSWCVIMQX I3Dg== MIME-Version: 1.0 X-Received: by 10.205.116.131 with SMTP id fi3mr3057113bkc.58.1364287511299; Tue, 26 Mar 2013 01:45:11 -0700 (PDT) Received: by 10.204.30.210 with HTTP; Tue, 26 Mar 2013 01:45:11 -0700 (PDT) Date: Tue, 26 Mar 2013 16:45:11 +0800 Message-ID: Subject: [PATCH -next v2] [media] go7007: fix invalid use of sizeof in go7007_usb_i2c_master_xfer() From: Wei Yongjun To: hans.verkuil@cisco.com, mchehab@redhat.com, gregkh@linuxfoundation.org Cc: yongjun_wei@trendmicro.com.cn, linux-media@vger.kernel.org, devel@driverdev.osuosl.org Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org From: Wei Yongjun 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 Acked-by: Hans Verkuil --- drivers/staging/media/go7007/go7007-usb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/staging/media/go7007/go7007-usb.c b/drivers/staging/media/go7007/go7007-usb.c index 0823506..d455c0b 100644 --- a/drivers/staging/media/go7007/go7007-usb.c +++ b/drivers/staging/media/go7007/go7007-usb.c @@ -1035,7 +1035,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;