Re: [PATCH] mm: incorrect overflow check in shrink_slab()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, 1 Dec 2011 04:20:34 -0500
Xi Wang <xi.wang@xxxxxxxxx> wrote:

> total_scan is unsigned long, so the overflow check (total_scan < 0)
> didn't work.
> 
> Signed-off-by: Xi Wang <xi.wang@xxxxxxxxx>

Nice catch but.... the 'total_scan" shouldn't be long ?
Rather than type casting ?

Thanks,
-Kame
> ---
>  mm/vmscan.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/mm/vmscan.c b/mm/vmscan.c
> index a1893c0..46a04e7 100644
> --- a/mm/vmscan.c
> +++ b/mm/vmscan.c
> @@ -270,7 +270,7 @@ unsigned long shrink_slab(struct shrink_control *shrink,
>  		delta *= max_pass;
>  		do_div(delta, lru_pages + 1);
>  		total_scan += delta;
> -		if (total_scan < 0) {
> +		if ((long)total_scan < 0) {
>  			printk(KERN_ERR "shrink_slab: %pF negative objects to "
>  			       "delete nr=%ld\n",
>  			       shrinker->shrink, total_scan);
> -- 
> 1.7.5.4
> 
> 
> 

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@xxxxxxxxx.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@xxxxxxxxx";> email@xxxxxxxxx </a>


[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]