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]
Message-ID: <20100514021508.GA7810@localhost>
Date:	Fri, 14 May 2010 10:15:08 +0800
From:	Wu Fengguang <fengguang.wu@...el.com>
To:	Cesar Eduardo Barros <cesarb@...arb.net>
Cc:	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	"linux-mm@...ck.org" <linux-mm@...ck.org>,
	Andrew Morton <akpm@...ux-foundation.org>
Subject: Re: [PATCH] radix-tree: fix radix_tree_prev_hole underflow case

On Fri, May 14, 2010 at 10:05:24AM +0800, Cesar Eduardo Barros wrote:
> radix_tree_prev_hole() used LONG_MAX to detect underflow; however,
> ULONG_MAX is clearly what was intended, both here and by its only user
> (count_history_pages at mm/readahead.c).
 
Good catch, thanks! I actually have a more smart
radix_tree_prev_hole() that uses ULONG_MAX.

Andrew, fortunately this bug has little impact on readahead.

Reviewed-by: Wu Fengguang <fengguang.wu@...el.com>

> Cc: Wu Fengguang <fengguang.wu@...el.com>
> Signed-off-by: Cesar Eduardo Barros <cesarb@...arb.net>
> ---
>  lib/radix-tree.c |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/lib/radix-tree.c b/lib/radix-tree.c
> index b69031f..be40980 100644
> --- a/lib/radix-tree.c
> +++ b/lib/radix-tree.c
> @@ -656,7 +656,7 @@ EXPORT_SYMBOL(radix_tree_next_hole);
>   *
>   *	Returns: the index of the hole if found, otherwise returns an index
>   *	outside of the set specified (in which case 'index - return >= max_scan'
> - *	will be true). In rare cases of wrap-around, LONG_MAX will be returned.
> + *	will be true). In rare cases of wrap-around, ULONG_MAX will be returned.
>   *
>   *	radix_tree_next_hole may be called under rcu_read_lock. However, like
>   *	radix_tree_gang_lookup, this will not atomically search a snapshot of
> @@ -674,7 +674,7 @@ unsigned long radix_tree_prev_hole(struct radix_tree_root *root,
>  		if (!radix_tree_lookup(root, index))
>  			break;
>  		index--;
> -		if (index == LONG_MAX)
> +		if (index == ULONG_MAX)
>  			break;
>  	}
>  
> -- 
> 1.6.6.1
--
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