[Cluster-devel] [PATCH 02/11] gfs2_edit: Check return value of compute_constants

Andrew Price anprice at redhat.com
Fri Jan 6 15:19:21 UTC 2012


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);
-- 
1.7.6.4




More information about the Cluster-devel mailing list