xfs
[Top] [All Lists]

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

To: Christoph Hellwig <hch@xxxxxxxxxxxxx>
Subject: Re: [PATCH 1/5] xfsprogs: libxcmd: don't clobber fs_table on realloc()
From: Alex Elder <aelder@xxxxxxx>
Date: Thu, 29 Sep 2011 09:10:55 -0500
Cc: <xfs@xxxxxxxxxxx>
In-reply-to: <20110929005946.GA26863@xxxxxxxxxxxxx>
References: <1317207432-8464-1-git-send-email-aelder@xxxxxxx> <08dbe8c3d0f49bac0c18570a68e7aa983cb4c731.1317207144.git.aelder@xxxxxxx> <20110929005946.GA26863@xxxxxxxxxxxxx>
Reply-to: <aelder@xxxxxxx>
On Wed, 2011-09-28 at 20:59 -0400, Christoph Hellwig wrote:
> 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?

No, just by inspection.

I'm working on fixing a different problem, and to do
so I need to rearrange things a bit.  Along the way
I found a bunch of little annoyances like this one,
so I figured I might as well fix them while I'm in
there.
  
> Reviewed-by: Christoph Hellwig <hch@xxxxxx>

Thanks a lot for the reviews.

                                        -Alex


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