gfs2-utils: master - gfs2_edit: Check return value of compute_constants

Andrew Price andyp at fedoraproject.org
Fri Jan 6 15:27:31 UTC 2012


Gitweb:        http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=d8bb8e2a981287ea7bc5cf7a73753b6e809edb72
Commit:        d8bb8e2a981287ea7bc5cf7a73753b6e809edb72
Parent:        98b8634553004ba514febfd19b680d509900a35f
Author:        Andrew Price <anprice at redhat.com>
AuthorDate:    Thu Jan 5 16:19:30 2012 +0000
Committer:     Andrew Price <anprice at redhat.com>
CommitterDate: Thu Jan 5 16:19:30 2012 +0000

gfs2_edit: Check return value of compute_constants

Spotted by coverity: Calling function "compute_constants" without
checking return value.

Signed-off-by: Andrew Price <anprice at redhat.com>
---
 gfs2/edit/hexedit.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/gfs2/edit/hexedit.c b/gfs2/edit/hexedit.c
index 73fb39f..fcab625 100644
--- a/gfs2/edit/hexedit.c
+++ b/gfs2/edit/hexedit.c
@@ -1276,7 +1276,10 @@ static void read_superblock(int fd)
 		perror(sbd.device_name);
 		exit(-1);
 	}
-	compute_constants(&sbd);
+	if(compute_constants(&sbd)) {
+		fprintf(stderr, "Failed to compute constants.\n");
+		exit(-1);
+	}
 	if (sbd.gfs1 || (sbd.sd_sb.sb_header.mh_magic == GFS2_MAGIC &&
 		     sbd.sd_sb.sb_header.mh_type == GFS2_METATYPE_SB))
 		block = 0x10 * (GFS2_DEFAULT_BSIZE / sbd.bsize);


More information about the cluster-commits mailing list