lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Sun, 12 Sep 2010 14:29:55 +0200
From:	Johannes Weiner <hannes@...xchg.org>
To:	Jaswinder Singh Rajput <jaswinder@...radead.org>
Cc:	Chris Mason <chris.mason@...cle.com>, linux-btrfs@...r.kernel.org,
	LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] Btrfs: Remove useless condition

On Sun, Sep 12, 2010 at 04:32:20PM +0530, Jaswinder Singh Rajput wrote:
> 
> if (ret) is useless as it will be never NULL as in previous statement
> we are setting ret = prev for !ret

If there is no match and no extent below the given file offset, `prev'
will be NULL as well, no?

So the check is not useless, it prevents throwing out a cached success
in case of a lookup failure.

> Signed-off-by: Jaswinder Singh Rajput <jaswinderrajput@...il.com>
> Cc: Chris Mason <chris.mason@...cle.com>
> ---
>  fs/btrfs/ordered-data.c |    3 +--
>  1 files changed, 1 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/btrfs/ordered-data.c b/fs/btrfs/ordered-data.c
> index e56c72b..7b04008 100644
> --- a/fs/btrfs/ordered-data.c
> +++ b/fs/btrfs/ordered-data.c
> @@ -154,8 +154,7 @@ static inline struct rb_node *tree_search(struct btrfs_ordered_inode_tree *tree,
>  	ret = __tree_search(root, file_offset, &prev);
>  	if (!ret)
>  		ret = prev;
> -	if (ret)
> -		tree->last = ret;
> +	tree->last = ret;
>  	return ret;
>  }
>  
> -- 
> 1.7.2.2
> 
> 
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@...r.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ