diff mbox

cfg80211: fix elapsed_jiffies calculation

Message ID 1402999622-27880-1-git-send-email-eliad@wizery.com (mailing list archive)
State Not Applicable, archived
Headers show

Commit Message

Eliad Peller June 17, 2014, 10:07 a.m. UTC
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(-)

Comments

Johannes Berg June 23, 2014, 9:29 a.m. UTC | #1
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

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

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