Powered by Linux
likely/unlikely usage validation — Semantic Matching Tool

likely/unlikely usage validation

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

 



I misplaced a closing ) in a patch using unlikely() and broke the
comparison, see [1] for context.

The fix was:
-               if (unlikely(abs(count + amount)) >= batch) {
+               if (unlikely(abs(count + amount) >= batch)) {

Neither kernel build with W=1 nor C=1 (smatch) report the problem.

Given that this compiles fine and for many cases with the bogus usage
it also happens to produce the correct result, I have to suspect there
are spots in the kernel with the problem.

Either way, sounds like something smatch should be testing for.

[1] https://lore.kernel.org/oe-lkp/pywb7wcml44gzgidn7mtwwr23mybbilakckchk4777wfibtruj@n4yiwwpvglf7/T/#t

-- 
Mateusz Guzik <mjguzik gmail.com>




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux