* [PATCH] cfg80211: fix elapsed_jiffies calculation
@ 2014-06-17 10:07 Eliad Peller
2014-06-23 9:29 ` Johannes Berg
0 siblings, 1 reply; 2+ messages in thread
From: Eliad Peller @ 2014-06-17 10:07 UTC (permalink / raw)
To: Johannes Berg; +Cc: linux-wireless
MAX_JIFFY_OFFSET has no meaning when calculating the
elapsed jiffies, as jiffies run out until ULONG_MAX.
This miscalculation results in erroneous values
in case of a wrap-around.
Signed-off-by: Eliad Peller <eliad@wizery.com>
---
since this function is currently used only
for returning values to userspace (e.g. time
in current dfs state), it's probably not
needed for stable.
net/wireless/core.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/wireless/core.h b/net/wireless/core.h
index 402a653..c43b0ce 100644
--- a/net/wireless/core.h
+++ b/net/wireless/core.h
@@ -418,7 +418,7 @@ static inline unsigned int elapsed_jiffies_msecs(unsigned long start)
if (end >= start)
return jiffies_to_msecs(end - start);
- return jiffies_to_msecs(end + (MAX_JIFFY_OFFSET - start) + 1);
+ return jiffies_to_msecs(end + (ULONG_MAX - start) + 1);
}
void
--
1.8.5.2.229.g4448466.dirty
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] cfg80211: fix elapsed_jiffies calculation
2014-06-17 10:07 [PATCH] cfg80211: fix elapsed_jiffies calculation Eliad Peller
@ 2014-06-23 9:29 ` Johannes Berg
0 siblings, 0 replies; 2+ messages in thread
From: Johannes Berg @ 2014-06-23 9:29 UTC (permalink / raw)
To: Eliad Peller; +Cc: linux-wireless
On Tue, 2014-06-17 at 13:07 +0300, Eliad Peller wrote:
> MAX_JIFFY_OFFSET has no meaning when calculating the
> elapsed jiffies, as jiffies run out until ULONG_MAX.
>
> This miscalculation results in erroneous values
> in case of a wrap-around.
Applied, thanks.
johannes
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-06-23 9:29 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-06-17 10:07 [PATCH] cfg80211: fix elapsed_jiffies calculation Eliad Peller
2014-06-23 9:29 ` Johannes Berg
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.