提交 a14ca61d 编写于 作者: L Linus Lüssing 提交者: Greg Kroah-Hartman

Staging: batman-adv: Avoid rounding issues for local hna timeout

With the current default values, this patch is not critical, as
LOCAL_HNA_TIMEOUT is a multiple of 1000 anyway. However, if someone
would like to change this #define, the person could have some
unexpected rounding issues. Therefore doing the multiplication before
the division now.
Signed-off-by: NLinus Lüssing <linus.luessing@web.de>
Signed-off-by: NSven Eckelmann <sven.eckelmann@gmx.de>
Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
上级 6e0e9388
......@@ -258,7 +258,7 @@ static void hna_local_purge(struct work_struct *work)
hna_local_entry = hashit.bucket->data;
timeout = hna_local_entry->last_seen +
((LOCAL_HNA_TIMEOUT / 1000) * HZ);
((LOCAL_HNA_TIMEOUT * HZ) / 1000);
if ((!hna_local_entry->never_purge) &&
time_after(jiffies, timeout))
hna_local_del(hna_local_entry, "address timed out");
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册