xfs
[Top] [All Lists]

Re: [PATCH 1/5] xfsprogs: libxcmd: don't clobber fs_table on realloc()

To: Alex Elder <aelder@xxxxxxx>
Subject: Re: [PATCH 1/5] xfsprogs: libxcmd: don't clobber fs_table on realloc()
From: Christoph Hellwig <hch@xxxxxxxxxxxxx>
Date: Wed, 28 Sep 2011 20:59:46 -0400
Cc: xfs@xxxxxxxxxxx
In-reply-to: <08dbe8c3d0f49bac0c18570a68e7aa983cb4c731.1317207144.git.aelder@xxxxxxx>
References: <1317207432-8464-1-git-send-email-aelder@xxxxxxx> <08dbe8c3d0f49bac0c18570a68e7aa983cb4c731.1317207144.git.aelder@xxxxxxx>
User-agent: Mutt/1.5.21 (2010-09-15)
On Wed, Sep 28, 2011 at 05:57:08AM -0500, Alex Elder wrote:
> In fs_table_insert(), realloc() is called to resize the global
> fs_table.  If it fails, it overwrites a previously valid fs_table
> pointer with NULL.
> 
> Instead, assign the return value to a local temporary and overwrite
> fs_table only if the realloc() call succeeds.  The only defined
> errno value for a realloc() failure is ENOMEM, so return that
> explicitly in the event it fails.

Looks good.  Did you encounter this issue in real life?

Reviewed-by: Christoph Hellwig <hch@xxxxxx>

<Prev in Thread] Current Thread [Next in Thread>