[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20110916225555.GP16246@thunk.org>
Date: Fri, 16 Sep 2011 18:55:55 -0400
From: Ted Ts'o <tytso@....edu>
To: Eric Sandeen <sandeen@...hat.com>
Cc: linux-ext4@...r.kernel.org
Subject: Re: [PATCH 13/25] e2fsprogs: Fix some error cleanup path bugs
On Fri, Sep 16, 2011 at 03:49:28PM -0500, Eric Sandeen wrote:
> In inode_open(), if the allocation of &io fails, we go to cleanup
> and dereference io to test io->name, which is a bug.
>
> Similarly in undo_open() if allocation of &data fails, we
> go to cleanup and dereference data to test data->real.
>
> In the test_open() case we explicitly set retval to the only
> possible error return from ext2fs_get_mem(), so remove that
> for tidiness.
>
> The other changes just make make earlier returns go through
> the error goto for consistency.
>
> In many cases we returned directly from the first error, but
> "goto cleanup" etc for every subsequent error. In some
> cases this leads to "impossible" tests such as:
>
> if (ptr)
> ext2fs_free_mem(&ptr)
>
> on paths where ptr cannot be null because we would have
> returned directly earlier, and Coverity flags this.
>
> This isn't really indicative of an error in most cases, but
> I think it can be clearer to always exit through the error goto
> if it's used later in the function.
>
> Signed-off-by: Eric Sandeen <sandeen@...hat.com>
Applied, thanks.
- Ted
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists