lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <tip-07d7e12091f4ab869cc6a4bb276399057e73b0b3@git.kernel.org>
Date:   Wed, 10 Apr 2019 06:28:10 -0700
From:   tip-bot for Andrei Vagin <tipbot@...or.com>
To:     linux-tip-commits@...r.kernel.org
Cc:     tglx@...utronix.de, linux-kernel@...r.kernel.org,
        mojha@...eaurora.org, hpa@...or.com, mingo@...nel.org,
        john.stultz@...aro.org, avagin@...il.com, sboyd@...nel.org
Subject: [tip:timers/urgent] alarmtimer: Return correct remaining time

Commit-ID:  07d7e12091f4ab869cc6a4bb276399057e73b0b3
Gitweb:     https://git.kernel.org/tip/07d7e12091f4ab869cc6a4bb276399057e73b0b3
Author:     Andrei Vagin <avagin@...il.com>
AuthorDate: Sun, 7 Apr 2019 21:15:42 -0700
Committer:  Thomas Gleixner <tglx@...utronix.de>
CommitDate: Wed, 10 Apr 2019 15:23:26 +0200

alarmtimer: Return correct remaining time

To calculate a remaining time, it's required to subtract the current time
from the expiration time. In alarm_timer_remaining() the arguments of
ktime_sub are swapped.

Fixes: d653d8457c76 ("alarmtimer: Implement remaining callback")
Signed-off-by: Andrei Vagin <avagin@...il.com>
Signed-off-by: Thomas Gleixner <tglx@...utronix.de>
Reviewed-by: Mukesh Ojha <mojha@...eaurora.org>
Cc: Stephen Boyd <sboyd@...nel.org>
Cc: John Stultz <john.stultz@...aro.org>
Cc: stable@...r.kernel.org
Link: https://lkml.kernel.org/r/20190408041542.26338-1-avagin@gmail.com

---
 kernel/time/alarmtimer.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/time/alarmtimer.c b/kernel/time/alarmtimer.c
index 2c97e8c2d29f..0519a8805aab 100644
--- a/kernel/time/alarmtimer.c
+++ b/kernel/time/alarmtimer.c
@@ -594,7 +594,7 @@ static ktime_t alarm_timer_remaining(struct k_itimer *timr, ktime_t now)
 {
 	struct alarm *alarm = &timr->it.alarm.alarmtimer;
 
-	return ktime_sub(now, alarm->node.expires);
+	return ktime_sub(alarm->node.expires, now);
 }
 
 /**

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ