Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1229358

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

From David Howells <dhowells@redhat.com>
Newsgroups linux.kernel
Subject Re: [PATCH 32/38] fs/cachefiles: remove invalid checks
Date 2015-09-21 15:50 +0200
Message-ID <qb9DL-8gq-77@gated-at.bofh.it> (permalink)
References <qb9u2-83M-1@gated-at.bofh.it> <qb9u2-83M-3@gated-at.bofh.it> <qb9u2-83M-1@gated-at.bofh.it>
Organization Red Hat UK Ltd. Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SI4 1TE, United Kingdom. Registered in England and Wales under Company Registration No. 3798903

Show all headers | View raw


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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 32/38] fs/cachefiles: remove invalid checks Andrzej Hajda <a.hajda@samsung.com> - 2015-09-21 15:40 +0200
  Re: [PATCH 32/38] fs/cachefiles: remove invalid checks David Howells <dhowells@redhat.com> - 2015-09-21 15:50 +0200
    Re: [PATCH 32/38] fs/cachefiles: remove invalid checks David Howells <dhowells@redhat.com> - 2015-09-21 18:20 +0200

csiph-web