From patchwork Sun Dec 13 11:41:12 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julia Lawall X-Patchwork-Id: 2298 Return-path: Envelope-to: mchehab@infradead.org Delivery-date: Sun, 13 Dec 2009 11:41:28 +0000 Received: from bombadil.infradead.org [18.85.46.34] by pedra with IMAP (fetchmail-6.3.6) for (single-drop); Sun, 13 Dec 2009 10:02:28 -0200 (BRST) Received: from vger.kernel.org ([209.132.180.67]) by bombadil.infradead.org with esmtp (Exim 4.69 #1 (Red Hat Linux)) id 1NJmpL-00073s-TT; Sun, 13 Dec 2009 11:41:28 +0000 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752607AbZLMLlX (ORCPT + 1 other); Sun, 13 Dec 2009 06:41:23 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752653AbZLMLlS (ORCPT ); Sun, 13 Dec 2009 06:41:18 -0500 Received: from mgw2.diku.dk ([130.225.96.92]:39085 "HELO mgw2.diku.dk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1752613AbZLMLlP (ORCPT ); Sun, 13 Dec 2009 06:41:15 -0500 Received: from localhost (localhost [127.0.0.1]) by mgw2.diku.dk (Postfix) with ESMTP id A3BB719BBA8; Sun, 13 Dec 2009 12:41:13 +0100 (CET) Received: from mgw2.diku.dk ([127.0.0.1]) by localhost (mgw2.diku.dk [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 08891-19; Sun, 13 Dec 2009 12:41:12 +0100 (CET) Received: from nhugin.diku.dk (nhugin.diku.dk [130.225.96.140]) by mgw2.diku.dk (Postfix) with ESMTP id 8502F19BB95; Sun, 13 Dec 2009 12:41:12 +0100 (CET) Received: from ask.diku.dk (ask.diku.dk [130.225.96.225]) by nhugin.diku.dk (Postfix) with ESMTP id 314386DF8B9; Sun, 13 Dec 2009 12:37:21 +0100 (CET) Received: by ask.diku.dk (Postfix, from userid 3767) id 6DEF1480B; Sun, 13 Dec 2009 12:41:12 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by ask.diku.dk (Postfix) with ESMTP id 667224225; Sun, 13 Dec 2009 12:41:12 +0100 (CET) Date: Sun, 13 Dec 2009 12:41:12 +0100 (CET) From: Julia Lawall To: mchehab@infradead.org, linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [PATCH 3/9] drivers/media: Correct code taking the size of a pointer Message-ID: MIME-Version: 1.0 X-Virus-Scanned: amavisd-new at diku.dk Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org From: Julia Lawall sizeof(print_buf) is just the size of the pointer. Change it to the size used in the allocation of print_buf earlier in the same function. A simplified version of the semantic patch that finds this problem is as follows: (http://coccinelle.lip6.fr/) // @@ expression *x; expression f; type T; @@ *f(...,(T)x,...) // Signed-off-by: Julia Lawall --- drivers/media/video/hdpvr/hdpvr-core.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) -- 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/media/video/hdpvr/hdpvr-core.c b/drivers/media/video/hdpvr/hdpvr-core.c index e280eb1..51f393d 100644 --- a/drivers/media/video/hdpvr/hdpvr-core.c +++ b/drivers/media/video/hdpvr/hdpvr-core.c @@ -145,7 +145,7 @@ static int device_authorization(struct hdpvr_device *dev) #ifdef HDPVR_DEBUG else { hex_dump_to_buffer(dev->usbc_buf, 46, 16, 1, print_buf, - sizeof(print_buf), 0); + 5*buf_size+1, 0); v4l2_dbg(MSG_INFO, hdpvr_debug, &dev->v4l2_dev, "Status request returned, len %d: %s\n", ret, print_buf); @@ -168,13 +168,13 @@ static int device_authorization(struct hdpvr_device *dev) response = dev->usbc_buf+38; #ifdef HDPVR_DEBUG - hex_dump_to_buffer(response, 8, 16, 1, print_buf, sizeof(print_buf), 0); + hex_dump_to_buffer(response, 8, 16, 1, print_buf, 5*buf_size+1, 0); v4l2_dbg(MSG_INFO, hdpvr_debug, &dev->v4l2_dev, "challenge: %s\n", print_buf); #endif challenge(response); #ifdef HDPVR_DEBUG - hex_dump_to_buffer(response, 8, 16, 1, print_buf, sizeof(print_buf), 0); + hex_dump_to_buffer(response, 8, 16, 1, print_buf, 5*buf_size+1, 0); v4l2_dbg(MSG_INFO, hdpvr_debug, &dev->v4l2_dev, " response: %s\n", print_buf); #endif