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

[Cluster-devel] [PATCH 11/11] gfs2_edit: Fix null pointer derefs in display_block_type()



Spotted by coverity: Dereferencing null variable "rgd".

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

diff --git a/gfs2/edit/hexedit.c b/gfs2/edit/hexedit.c
index 02a4091..69d499e 100644
--- a/gfs2/edit/hexedit.c
+++ b/gfs2/edit/hexedit.c
@@ -713,7 +713,7 @@ int display_block_type(int from_restore)
 		if ((be32_to_cpu(mh->mh_type) == GFS2_METATYPE_RG)) {
 			int ptroffset = edit_row[dmode] * 16 + edit_col[dmode];
 
-			if (ptroffset >= struct_len || pgnum) {
+			if (rgd && (ptroffset >= struct_len || pgnum)) {
 				int blknum, b, btype;
 
 				blknum = pgnum * screen_chunk_size;
@@ -731,7 +731,7 @@ int display_block_type(int from_restore)
 		} else if ((be32_to_cpu(mh->mh_type) == GFS2_METATYPE_RB)) {
 			int ptroffset = edit_row[dmode] * 16 + edit_col[dmode];
 
-			if (ptroffset >= struct_len || pgnum) {
+			if (rgd && (ptroffset >= struct_len || pgnum)) {
 				int blknum, b, btype, rb_number;
 
 				rb_number = block - rgd->ri.ri_addr;
-- 
1.7.6.4


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