From patchwork Mon Feb 7 12:46:25 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kevin Wolf X-Patchwork-Id: 82242 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id E5BF2B7043 for ; Tue, 8 Feb 2011 10:44:38 +1100 (EST) Received: from localhost ([127.0.0.1]:33172 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PmR4h-0000IU-Bn for incoming@patchwork.ozlabs.org; Mon, 07 Feb 2011 08:24:15 -0500 Received: from [140.186.70.92] (port=36953 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PmQSq-0008JW-9o for qemu-devel@nongnu.org; Mon, 07 Feb 2011 07:45:09 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PmQSk-0001XD-2h for qemu-devel@nongnu.org; Mon, 07 Feb 2011 07:45:06 -0500 Received: from mx1.redhat.com ([209.132.183.28]:28852) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PmQSj-0001UG-O2 for qemu-devel@nongnu.org; Mon, 07 Feb 2011 07:45:01 -0500 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p17CitSg006927 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 7 Feb 2011 07:44:55 -0500 Received: from dhcp-5-188.str.redhat.com (dhcp-5-175.str.redhat.com [10.32.5.175]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id p17Cin3x027395; Mon, 7 Feb 2011 07:44:54 -0500 From: Kevin Wolf To: anthony@codemonkey.ws Date: Mon, 7 Feb 2011 13:46:25 +0100 Message-Id: <1297082796-1369-4-git-send-email-kwolf@redhat.com> In-Reply-To: <1297082796-1369-1-git-send-email-kwolf@redhat.com> References: <1297082796-1369-1-git-send-email-kwolf@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.25 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.132.183.28 Cc: kwolf@redhat.com, qemu-devel@nongnu.org Subject: [Qemu-devel] [STABLE 0.14][PATCH 03/14] block/vdi: Fix wrong size in conditionally used memset, memcmp X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Stefan Weil Error report from cppcheck: block/vdi.c:122: error: Using sizeof for array given as function argument returns the size of pointer. block/vdi.c:128: error: Using sizeof for array given as function argument returns the size of pointer. Fix both by setting the correct size. The buggy code is only used when QEMU is build without uuid support. The bug is not critical, so there is no urgent need to apply it to old versions of QEMU. Cc: Kevin Wolf Signed-off-by: Stefan Weil Signed-off-by: Kevin Wolf (cherry picked from commit 4f3669ea5bd73ade0dce5f1155cb9ad9788fd54c) --- block/vdi.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/block/vdi.c b/block/vdi.c index ab8f70f..116b25b 100644 --- a/block/vdi.c +++ b/block/vdi.c @@ -119,13 +119,13 @@ void uuid_unparse(const uuid_t uu, char *out); #if !defined(CONFIG_UUID) void uuid_generate(uuid_t out) { - memset(out, 0, sizeof(out)); + memset(out, 0, sizeof(uuid_t)); } int uuid_is_null(const uuid_t uu) { uuid_t null_uuid = { 0 }; - return memcmp(uu, null_uuid, sizeof(uu)) == 0; + return memcmp(uu, null_uuid, sizeof(uuid_t)) == 0; } void uuid_unparse(const uuid_t uu, char *out)