Re: [PATCH 32/38] fs/cachefiles: remove invalid checks

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

 



Andrzej Hajda <a.hajda@xxxxxxxxxxx> wrote:

> The problem has been detected using proposed semantic patch
> scripts/coccinelle/tests/unsigned_lesser_than_zero.cocci [1].

This is a problem in your test.  There's no actual problem with the code.

> -	ASSERT(cache->fstop_percent >= 0 &&

This is fine.  The compiler should just ignore it.

> -	       cache->fstop_percent < cache->fcull_percent &&
> -	       cache->fcull_percent < cache->frun_percent &&
> -	       cache->frun_percent  < 100);
> +	ASSERT(cache->fstop_percent < cache->fcull_percent &&
> +	       cache->fcull_percent < cache->frun_percent);

You've lost the upper bound check.

> -	if (datalen < 0 || datalen > PAGE_SIZE - 1)
> -	if (fstop < 0 || fstop >= cache->fcull_percent)
> -	if (bstop < 0 || bstop >= cache->bcull_percent)

These are all fine.  The compiler should just ignore them.

David

--
Linux-cachefs mailing list
Linux-cachefs@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/linux-cachefs



[Index of Archives]     [LARTC]     [Bugtraq]     [Yosemite Forum]
  Powered by Linux