X-Spam-Checker-Version: SpamAssassin 3.4.0-r929098 (2010-03-30) on oss.sgi.com X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham version=3.4.0-r929098 Received: from relay.sgi.com (relay3.corp.sgi.com [198.149.34.15]) by oss.sgi.com (8.14.3/8.14.3/SuSE Linux 0.8) with ESMTP id p8TEB40h196402 for ; Thu, 29 Sep 2011 09:11:04 -0500 Received: from xmail.sgi.com (pv-excas3-dc21.corp.sgi.com [137.38.102.206]) by relay3.corp.sgi.com (Postfix) with ESMTP id CFF8AAC003; Thu, 29 Sep 2011 07:11:00 -0700 (PDT) Received: from [127.0.0.1] (128.162.232.50) by xmail.sgi.com (137.38.102.30) with Microsoft SMTP Server (TLS) id 14.1.289.1; Thu, 29 Sep 2011 09:10:56 -0500 Subject: Re: [PATCH 1/5] xfsprogs: libxcmd: don't clobber fs_table on realloc() From: Alex Elder Reply-To: To: Christoph Hellwig CC: In-Reply-To: <20110929005946.GA26863@infradead.org> References: <1317207432-8464-1-git-send-email-aelder@sgi.com> <08dbe8c3d0f49bac0c18570a68e7aa983cb4c731.1317207144.git.aelder@sgi.com> <20110929005946.GA26863@infradead.org> Content-Type: text/plain; charset="UTF-8" Date: Thu, 29 Sep 2011 09:10:55 -0500 Message-ID: <1317305455.3049.2.camel@doink> MIME-Version: 1.0 X-Mailer: Evolution 2.32.2 Content-Transfer-Encoding: 7bit X-Originating-IP: [128.162.232.50] X-Virus-Scanned: ClamAV version 0.94.2, clamav-milter version 0.94.2 on oss.sgi.com X-Virus-Status: Clean 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 Thanks a lot for the reviews. -Alex