[PATCH 1/5] xfsprogs: libxcmd: don't clobber fs_table on realloc()
Alex Elder
aelder at sgi.com
Thu Sep 29 09:10:55 CDT 2011
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 at lst.de>
Thanks a lot for the reviews.
-Alex
More information about the xfs
mailing list