From patchwork Tue Jan 8 13:53:50 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hannes Reinecke X-Patchwork-Id: 1946121 Return-Path: X-Original-To: patchwork-dm-devel@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from mx3-phx2.redhat.com (mx3-phx2.redhat.com [209.132.183.24]) by patchwork1.kernel.org (Postfix) with ESMTP id 4E32F3FC5A for ; Tue, 8 Jan 2013 13:58:43 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by mx3-phx2.redhat.com (8.13.8/8.13.8) with ESMTP id r08DtZch002148; Tue, 8 Jan 2013 08:55:36 -0500 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id r08DsVeK004581 for ; Tue, 8 Jan 2013 08:54:31 -0500 Received: from mx1.redhat.com (ext-mx15.extmail.prod.ext.phx2.redhat.com [10.5.110.20]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id r08DsVTg010391 for ; Tue, 8 Jan 2013 08:54:31 -0500 Received: from mx2.suse.de (cantor2.suse.de [195.135.220.15]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r08DsUZZ018796 for ; Tue, 8 Jan 2013 08:54:30 -0500 Received: from relay2.suse.de (unknown [195.135.220.254]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx2.suse.de (Postfix) with ESMTP id 200FDA51CA; Tue, 8 Jan 2013 14:54:28 +0100 (CET) From: Hannes Reinecke To: Christophe Varoqui Date: Tue, 8 Jan 2013 14:53:50 +0100 Message-Id: <1357653259-62650-13-git-send-email-hare@suse.de> In-Reply-To: <1357653259-62650-1-git-send-email-hare@suse.de> References: <1357653259-62650-1-git-send-email-hare@suse.de> X-RedHat-Spam-Score: -7.299 (BAYES_00, DCC_REPUT_00_12, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD) X-Scanned-By: MIMEDefang 2.67 on 10.5.11.11 X-Scanned-By: MIMEDefang 2.68 on 10.5.110.20 X-loop: dm-devel@redhat.com Cc: dm-devel@redhat.com Subject: [dm-devel] [PATCH 12/42] Valgrind fixes for prioritizer X-BeenThere: dm-devel@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk Reply-To: device-mapper development List-Id: device-mapper development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: dm-devel-bounces@redhat.com Errors-To: dm-devel-bounces@redhat.com Declaring an array does not zero out its contents. So we might be reading random garbage here. Signed-off-by: Hannes Reinecke --- libmultipath/prioritizers/hds.c | 1 + libmultipath/prioritizers/ontap.c | 1 + libmultipath/prioritizers/rdac.c | 1 + 3 files changed, 3 insertions(+), 0 deletions(-) diff --git a/libmultipath/prioritizers/hds.c b/libmultipath/prioritizers/hds.c index b22e1df..5d75f84 100644 --- a/libmultipath/prioritizers/hds.c +++ b/libmultipath/prioritizers/hds.c @@ -105,6 +105,7 @@ int hds_modular_prio (const char *dev, int fd) } memset (&io_hdr, 0, sizeof (sg_io_hdr_t)); + memset (inqBuff, 0, INQ_REPLY_LEN); io_hdr.interface_id = 'S'; io_hdr.cmd_len = sizeof (inqCmdBlk); io_hdr.mx_sb_len = sizeof (sense_buffer); diff --git a/libmultipath/prioritizers/ontap.c b/libmultipath/prioritizers/ontap.c index 0d34092..026d45d 100644 --- a/libmultipath/prioritizers/ontap.c +++ b/libmultipath/prioritizers/ontap.c @@ -80,6 +80,7 @@ static int send_gva(const char *dev, int fd, unsigned char pg, int ret = -1; memset(&io_hdr, 0, sizeof (struct sg_io_hdr)); + memset(results, 0, *results_size); io_hdr.interface_id = 'S'; io_hdr.cmd_len = sizeof (cdb); io_hdr.mx_sb_len = sizeof (sb); diff --git a/libmultipath/prioritizers/rdac.c b/libmultipath/prioritizers/rdac.c index 8667790..441b3b0 100644 --- a/libmultipath/prioritizers/rdac.c +++ b/libmultipath/prioritizers/rdac.c @@ -22,6 +22,7 @@ int rdac_prio(const char *dev, int fd) int ret = 0; memset(&io_hdr, 0, sizeof (struct sg_io_hdr)); + memset(sense_buffer, 0, 256); io_hdr.interface_id = 'S'; io_hdr.cmd_len = sizeof (inqCmdBlk); io_hdr.mx_sb_len = sizeof (sb);