linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Eric Sandeen <sandeen@redhat.com>
To: David Sterba <dsterba@suse.cz>, linux-btrfs@vger.kernel.org
Subject: Re: [PATCH 4/6] btrfs-progs: check result of first_cache_extent
Date: Fri, 19 Dec 2014 10:56:41 -0600	[thread overview]
Message-ID: <549458C9.2040603@redhat.com> (raw)
In-Reply-To: <813550c84636f7d570c541c22eee60b11346b4f3.1419005022.git.dsterba@suse.cz>

On 12/19/14 10:06 AM, David Sterba wrote:
> If the tree's empty, we'll get NULL and dereference it.

Hm, but this is under an explicit check for not empty:

        while (!cache_tree_empty(roots_info_cache)) {

sooo?  Maybe it's just defensive?  Nothing really wrong
with being defensive, I suppose, so:

Reviewed-by: Eric Sandeen <sandeen@redhat.com>

> Resolves-Coverity-CID: 1248828
> Signed-off-by: David Sterba <dsterba@suse.cz>
> ---
>  cmds-check.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/cmds-check.c b/cmds-check.c
> index 6eea36c2f52c..3e7a4ebdce44 100644
> --- a/cmds-check.c
> +++ b/cmds-check.c
> @@ -8075,6 +8075,8 @@ static void free_roots_info_cache(void)
>  		struct root_item_info *rii;
>  
>  		entry = first_cache_extent(roots_info_cache);
> +		if (!entry)
> +			break;
>  		remove_cache_extent(roots_info_cache, entry);
>  		rii = container_of(entry, struct root_item_info, cache_extent);
>  		free(rii);
> 


  reply	other threads:[~2014-12-19 16:56 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-19 16:06 [PATCH 0/6] Btrfs progs, coverity fixes for 3.18 David Sterba
2014-12-19 16:06 ` [PATCH 1/6] btrfs-progs: corrupt block, add missing break to option I David Sterba
2014-12-19 16:49   ` Eric Sandeen
2014-12-19 16:06 ` [PATCH 2/6] btrfs-progs: corrupt block, add break after option U David Sterba
2014-12-19 16:49   ` Eric Sandeen
2014-12-19 16:06 ` [PATCH 3/6] btrfs-progs: fragments, close output file on error David Sterba
2014-12-19 16:50   ` Eric Sandeen
2014-12-19 16:06 ` [PATCH 4/6] btrfs-progs: check result of first_cache_extent David Sterba
2014-12-19 16:56   ` Eric Sandeen [this message]
2014-12-19 17:03     ` David Sterba
2014-12-19 16:06 ` [PATCH 5/6] btrfs-progs: check allocation result in add_clone_source David Sterba
2014-12-19 16:58   ` Eric Sandeen
2014-12-19 16:06 ` [PATCH 6/6] btrfs-progs: let btrfs_free_path accept NULL David Sterba
2014-12-19 16:58   ` Eric Sandeen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=549458C9.2040603@redhat.com \
    --to=sandeen@redhat.com \
    --cc=dsterba@suse.cz \
    --cc=linux-btrfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).