FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Redhat > Cluster Development

 
 
LinkBack Thread Tools
 
Old 01-20-2012, 12:40 PM
Steven Whitehouse
 
Default fsck.gfs2: Fix unchecked malloc in gfs2_dup_set()

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
"));
> + return NULL;
> + }
> dups_found++;
> memset(data, 0, sizeof(struct duptree));
> /* Add new node and rebalance tree. */
 

Thread Tools




All times are GMT. The time now is 12:59 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org