Ray Lee wrote:
On Dec 26, 2007 7:21 AM, Julia Lawall <[email protected]> wrote:
- if (jiffies - ent->last_usage < timeout)
+ if (time_before(jiffies, ent->last_usage + timeout))
I don't think this is a safe change? subtraction is always safe (if
you think about it as 'distance'), addition isn't always safe unless
you know the range. The time_before macro will expand that out to
(effectively):
if ( (long)(ent->last_usage + timeout) - (long)(jiffies) < 0 )
which seems to introduce an overflow condition in the first term.
Dunno, I may be wrong (happens often), but at the very least what
you've transformed it into is no longer obviously correct, and so it's
not a great change.
Indeed. The bottom form will have overflow issues at time
jiffies_wraparound/2, whereas the top form will have overflow issues
only near jiffies_wraparound/1.
-hpa
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[Index of Archives]
[Kernel Newbies]
[Netfilter]
[Bugtraq]
[Photo]
[Stuff]
[Gimp]
[Yosemite News]
[MIPS Linux]
[ARM Linux]
[Linux Security]
[Linux RAID]
[Video 4 Linux]
[Linux for the blind]
[Linux Resources]