Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ipconfig: Use time_before

The functions time_before, time_before_eq, time_after, and time_after_eq
are more robust for comparing jiffies against other values.

A simplified version of the Coccinelle semantic patch making this change
is as follows:

@change@
expression E1,E2;
@@
- jiffies - E1 < E2
+ time_before(jiffies, E1+E2)

Signed-off-by: Himangi Saraogi <himangi774@gmail.com>
Acked-by: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Himangi Saraogi and committed by
David S. Miller
c72c95a0 b5c5c36d

+2 -1
+2 -1
net/ipv4/ipconfig.c
··· 262 262 /* wait for a carrier on at least one device */ 263 263 start = jiffies; 264 264 next_msg = start + msecs_to_jiffies(CONF_CARRIER_TIMEOUT/12); 265 - while (jiffies - start < msecs_to_jiffies(CONF_CARRIER_TIMEOUT)) { 265 + while (time_before(jiffies, start + 266 + msecs_to_jiffies(CONF_CARRIER_TIMEOUT))) { 266 267 int wait, elapsed; 267 268 268 269 for_each_netdev(&init_net, dev)