[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[Cluster-devel] [PATCH 5/8] 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 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];
 
-- 
1.7.6.5


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]