Re: [PATCH 32/38] fs/cachefiles: remove invalid checks
From: David Howells
Date: Mon Sep 21 2015 - 09:48:55 EST
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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/