gfs2-utils: master - gfs2_convert: Fix null pointer deref in conv_build_jindex

Andrew Price andyp at fedoraproject.org
Wed Jan 11 18:39:53 UTC 2012


Gitweb:        http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=55626ed257b0ae681e817e586e7b654e7ceec782
Commit:        55626ed257b0ae681e817e586e7b654e7ceec782
Parent:        50b6c4cab0781b34d204aabf639296f03ab241fa
Author:        Andrew Price <anprice at redhat.com>
AuthorDate:    Mon Jan 9 05:18:55 2012 +0000
Committer:     Andrew Price <anprice at redhat.com>
CommitterDate: Wed Jan 11 18:17:56 2012 +0000

gfs2_convert: Fix null pointer deref in conv_build_jindex

Spotted by coverity: Dereferencing a null pointer "sdp->md.journal".

Signed-off-by: Andrew Price <anprice at redhat.com>
---
 gfs2/convert/gfs2_convert.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/gfs2/convert/gfs2_convert.c b/gfs2/convert/gfs2_convert.c
index 9b54670..9944d23 100644
--- a/gfs2/convert/gfs2_convert.c
+++ b/gfs2/convert/gfs2_convert.c
@@ -1918,6 +1918,9 @@ static int conv_build_jindex(struct gfs2_sbd *sdp)
 
 	sdp->md.journal = malloc(sdp->md.journals *
 				 sizeof(struct gfs2_inode *));
+	if (sdp->md.journal == NULL) {
+		return errno;
+	}
 	for (j = 0; j < sdp->md.journals; j++) {
 		char name[256];
 


More information about the cluster-commits mailing list