]> git.baikalelectronics.ru Git - kernel.git/commit
coccinelle: tests: unsigned value cannot be lesser than zero
authorAndrzej Hajda <a.hajda@samsung.com>
Thu, 7 Jan 2016 09:36:51 +0000 (10:36 +0100)
committerMichal Marek <mmarek@suse.com>
Tue, 12 Jan 2016 16:47:47 +0000 (17:47 +0100)
commit9aba4cb9ca25203b8fd311bc4231888feecf3213
tree28ae00d701f940cedc277d73295c80220bdb8239
parent4efaa658a3a453d3b9f9b6019bba41aa7c3aeea5
coccinelle: tests: unsigned value cannot be lesser than zero

Unsigned expressions cannot be lesser than zero. Presence of comparisons
'unsigned (<|<=|>|>=) 0' often indicates a bug, usually wrong type of variable.
The patch beside finding such comparisons tries to eliminate false positives,
mainly by bypassing range checks.

gcc can detect such comparisons also using -Wtype-limits switch, but it warns
also in correct cases, making too much noise.

Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
Acked-by: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: Michal Marek <mmarek@suse.com>
scripts/coccinelle/tests/unsigned_lesser_than_zero.cocci [new file with mode: 0644]