From: Andrew Price <anprice@redhat.com>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] [PATCH 05/11] gfs2_edit: Fix null pointer dereference in dump_journal
Date: Fri, 6 Jan 2012 15:19:24 +0000 [thread overview]
Message-ID: <1325863170-32530-5-git-send-email-anprice@redhat.com> (raw)
In-Reply-To: <1325863170-32530-1-git-send-email-anprice@redhat.com>
Spotted by coverity: Dereferencing a pointer that might be null "(void
*)jbuf" when calling "fsck_readi"
Signed-off-by: Andrew Price <anprice@redhat.com>
---
gfs2/edit/hexedit.c | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/gfs2/edit/hexedit.c b/gfs2/edit/hexedit.c
index b05a7d6..7a17c04 100644
--- a/gfs2/edit/hexedit.c
+++ b/gfs2/edit/hexedit.c
@@ -2672,6 +2672,10 @@ static void dump_journal(const char *journal)
j_bh = bread(&sbd, jblock);
j_inode = inode_get(&sbd, j_bh);
jbuf = malloc(sbd.bsize);
+ if (jbuf == NULL) {
+ fprintf(stderr, "Out of memory\n");
+ exit(-1);
+ }
}
for (jb = 0; jb < j_size; jb += (sbd.gfs1 ? 1:sbd.bsize)) {
--
1.7.6.4
next prev 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 ` Andrew Price [this message]
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 ` [Cluster-devel] [PATCH 11/11] gfs2_edit: Fix null pointer derefs in display_block_type() Andrew Price
2012-01-06 15:24 ` 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-5-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).