lkml.org 
[lkml]   [2015]   [Sep]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH 32/38] fs/cachefiles: remove invalid checks
Date
Andrzej Hajda <a.hajda@samsung.com> 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


\
 
 \ /
  Last update: 2015-09-21 16:01    [W:8.448 / U:0.008 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site