cluster-devel.redhat.com archive mirror
 help / color / mirror / Atom feed
From: Andrew Price <anprice@redhat.com>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] [PATCH 11/11] gfs2_edit: Fix null pointer derefs in display_block_type()
Date: Fri,  6 Jan 2012 15:19:30 +0000	[thread overview]
Message-ID: <1325863170-32530-11-git-send-email-anprice@redhat.com> (raw)
In-Reply-To: <1325863170-32530-1-git-send-email-anprice@redhat.com>

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



  parent reply	other threads:[~2012-01-06 15:19 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-06 15:19 [Cluster-devel] [PATCH 01/11] gfs2_edit: Remove a useless assignment Andrew Price
2012-01-06 15:19 ` [Cluster-devel] [PATCH 02/11] gfs2_edit: Check return value of compute_constants Andrew Price
2012-01-06 15:19 ` [Cluster-devel] [PATCH 03/11] gfs2_edit: Fix possible uninitialized access Andrew Price
2012-01-06 15:19 ` [Cluster-devel] [PATCH 04/11] gfs2_edit: Fix memory leak in dump_journal() Andrew Price
2012-01-06 15:19 ` [Cluster-devel] [PATCH 05/11] gfs2_edit: Fix null pointer dereference in dump_journal Andrew Price
2012-01-06 15:19 ` [Cluster-devel] [PATCH 06/11] gfs2_edit: Remove unused j_inode from find_journal_block() Andrew Price
2012-01-06 15:19 ` [Cluster-devel] [PATCH 07/11] gfs2_edit: Fix memory leak in find_journal_block Andrew Price
2012-01-06 15:19 ` [Cluster-devel] [PATCH 08/11] gfs2_edit: Check for error value from gfs2_get_bitmap Andrew Price
2012-01-06 15:19 ` [Cluster-devel] [PATCH 09/11] gfs2_edit: Fix resource leaks in display_extended() Andrew Price
2012-01-06 15:19 ` [Cluster-devel] [PATCH 10/11] gfs2_edit: Fix resource leak in print_block_details() Andrew Price
2012-01-06 15:19 ` Andrew Price [this message]
2012-01-06 15:24   ` [Cluster-devel] [PATCH 11/11] gfs2_edit: Fix null pointer derefs in display_block_type() Steven Whitehouse

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1325863170-32530-11-git-send-email-anprice@redhat.com \
    --to=anprice@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).