From: Steven Whitehouse <swhiteho@redhat.com>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] [PATCH 3/3] fsck.gfs2: Fix unchecked malloc in gfs2_dup_set()
Date: Fri, 20 Jan 2012 13:40:41 +0000 [thread overview]
Message-ID: <1327066841.2723.4.camel@menhir> (raw)
In-Reply-To: <1327063167-10291-3-git-send-email-anprice@redhat.com>
Hi,
Those look good to me,
Steve.
On Fri, 2012-01-20 at 12:39 +0000, Andrew Price wrote:
> Spotted by coverity: Dereferencing a pointer that might be null "data"
> when calling "memset"
>
> Signed-off-by: Andrew Price <anprice@redhat.com>
> ---
> gfs2/fsck/util.c | 4 ++++
> 1 files changed, 4 insertions(+), 0 deletions(-)
>
> diff --git a/gfs2/fsck/util.c b/gfs2/fsck/util.c
> index f37fe7d..6c80ae8 100644
> --- a/gfs2/fsck/util.c
> +++ b/gfs2/fsck/util.c
> @@ -253,6 +253,10 @@ static struct duptree *gfs2_dup_set(uint64_t dblock, int create)
> if (!create)
> return NULL;
> data = malloc(sizeof(struct duptree));
> + if (data == NULL) {
> + log_crit( _("Unable to allocate duptree structure\n"));
> + return NULL;
> + }
> dups_found++;
> memset(data, 0, sizeof(struct duptree));
> /* Add new node and rebalance tree. */
prev parent reply other threads:[~2012-01-20 13:40 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-01-20 12:39 [Cluster-devel] [PATCH 1/3] libgfscontrol: Fix resource leaks Andrew Price
2012-01-20 12:39 ` [Cluster-devel] [PATCH 2/3] fsck.gfs2: Plug a leak in peruse_system_dinode() Andrew Price
2012-01-20 12:39 ` [Cluster-devel] [PATCH 3/3] fsck.gfs2: Fix unchecked malloc in gfs2_dup_set() Andrew Price
2012-01-20 13:40 ` Steven Whitehouse [this message]
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=1327066841.2723.4.camel@menhir \
--to=swhiteho@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).