Linux Archive

Linux Archive (http://www.linux-archive.org/)
-   Cluster Development (http://www.linux-archive.org/cluster-development/)
-   -   mkfs.gfs2: Fix use of uninitialized value in check_dev_content (http://www.linux-archive.org/cluster-development/619891-mkfs-gfs2-fix-use-uninitialized-value-check_dev_content.html)

Andrew Price 01-11-2012 05:21 PM

mkfs.gfs2: Fix use of uninitialized value in check_dev_content
 
Spotted by coverity: Using uninitialized value "p[0]" when calling
"close".

Signed-off-by: Andrew Price <anprice@redhat.com>
---
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


All times are GMT. The time now is 05:25 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.