From: Steven Whitehouse Date: Fri, 06 Jan 2012 15:24:05 +0000 Subject: [Cluster-devel] [PATCH 11/11] gfs2_edit: Fix null pointer derefs in display_block_type() In-Reply-To: <1325863170-32530-11-git-send-email-anprice@redhat.com> References: <1325863170-32530-1-git-send-email-anprice@redhat.com> <1325863170-32530-11-git-send-email-anprice@redhat.com> Message-ID: <1325863445.2703.29.camel@menhir> List-Id: To: cluster-devel.redhat.com MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Hi, Those all look good to me. ACK, Steve. On Fri, 2012-01-06 at 15:19 +0000, Andrew Price wrote: > Spotted by coverity: Dereferencing null variable "rgd". > > Signed-off-by: Andrew Price > --- > 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;