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] [day] [month] [year] [list]
Date:   Tue, 23 Apr 2019 11:50:51 -0400 (EDT)
From:   Mikulas Patocka <mpatocka@...hat.com>
To:     Huaisheng Ye <huye@...hat.com>
cc:     snitzer@...hat.com, agk@...hat.com, prarit@...hat.com,
        chengnt@...ovo.com, dm-devel@...hat.com,
        linux-kernel@...r.kernel.org, Huaisheng Ye <yehs1@...ovo.com>
Subject: Re: [PATCH] dm-writecache: add unlikely for returned value of
 rb_next/prev



On Fri, 12 Apr 2019, Huaisheng Ye wrote:

> From: Huaisheng Ye <yehs1@...ovo.com>
> 
> In functions writecache_discard and writecache_find_entry, there is
> high probablity that the pointer of structure rb_node doesn't equal
> to NULL. Add unlikly for the pointer node.
> 
> Signed-off-by: Huaisheng Ye <yehs1@...ovo.com>

Acked-by: Mikulas Patocka <mpatocka@...hat.com>

> ---
>  drivers/md/dm-writecache.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/md/dm-writecache.c b/drivers/md/dm-writecache.c
> index 5b4d1c1..cfbbfbc 100644
> --- a/drivers/md/dm-writecache.c
> +++ b/drivers/md/dm-writecache.c
> @@ -571,7 +571,7 @@ static struct wc_entry *writecache_find_entry(struct dm_writecache *wc,
>  			node = rb_prev(&e->rb_node);
>  		else
>  			node = rb_next(&e->rb_node);
> -		if (!node)
> +		if (unlikely(!node))
>  			return e;
>  		e2 = container_of(node, struct wc_entry, rb_node);
>  		if (read_original_sector(wc, e2) != block)
> @@ -804,7 +804,7 @@ static void writecache_discard(struct dm_writecache *wc, sector_t start, sector_
>  			writecache_free_entry(wc, e);
>  		}
>  
> -		if (!node)
> +		if (unlikely(!node))
>  			break;
>  
>  		e = container_of(node, struct wc_entry, rb_node);
> -- 
> 1.8.3.1
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ