From: Andrew Price Date: Wed, 11 Jan 2012 18:21:17 +0000 Subject: [Cluster-devel] [PATCH 3/8] mkfs.gfs2: Fix use of uninitialized value in check_dev_content In-Reply-To: <1326306082-20381-1-git-send-email-anprice@redhat.com> References: <1326306082-20381-1-git-send-email-anprice@redhat.com> Message-ID: <1326306082-20381-3-git-send-email-anprice@redhat.com> List-Id: To: cluster-devel.redhat.com MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Spotted by coverity: Using uninitialized value "p[0]" when calling "close". Signed-off-by: Andrew Price --- gfs2/mkfs/main_mkfs.c | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-) diff --git a/gfs2/mkfs/main_mkfs.c b/gfs2/mkfs/main_mkfs.c index 95afe41..3658fd4 100644 --- a/gfs2/mkfs/main_mkfs.c +++ b/gfs2/mkfs/main_mkfs.c @@ -428,7 +428,7 @@ static void check_dev_content(const char *devname) (char *)"-bs", (char *)devname, NULL }; - int p[2]; + int p[2] = {-1, -1}; int ret; int pid; @@ -463,7 +463,8 @@ fail: goto fail; printf( _("It appears to contain: %s"), content); } - close(p[0]); + if (p[0] >= 0) + close(p[0]); return; } -- 1.7.6.5