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>] [day] [month] [year] [list]
Message-Id: <20230711030149.55143-1-yingzuxin@vivo.com>
Date:   Tue, 11 Jul 2023 11:01:49 +0800
From:   ying zuxin <yingzuxin@...o.com>
To:     Thomas Gleixner <tglx@...utronix.de>,
        linux-kernel@...r.kernel.org (open list:POSIX CLOCKS and TIMERS)
Cc:     opensource.kernel@...o.com, luhongfei@...o.com,
        ying zuxin <yingzuxin@...o.com>
Subject: [PATCH] time/hrtimer: Use hrtimer_is_queued instead of accessingtimer bits directly

hrtimer_is_queued() offers an atomic method to check
whether the timer is on one of the queues, so there is no need
to access the timer bits directly.

Signed-off-by: ying zuxin <yingzuxin@...o.com>
---
 kernel/time/hrtimer.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/kernel/time/hrtimer.c b/kernel/time/hrtimer.c
index 238262e4aba7..9ffc54fe58dd 100644
--- a/kernel/time/hrtimer.c
+++ b/kernel/time/hrtimer.c
@@ -1047,7 +1047,7 @@ u64 hrtimer_forward(struct hrtimer *timer, ktime_t now, ktime_t interval)
 	if (delta < 0)
 		return 0;
 
-	if (WARN_ON(timer->state & HRTIMER_STATE_ENQUEUED))
+	if (WARN_ON(hrtimer_is_queued(timer)))
 		return 0;
 
 	if (interval < hrtimer_resolution)
@@ -1701,7 +1701,7 @@ static void __run_hrtimer(struct hrtimer_cpu_base *cpu_base,
 	 * for us already.
 	 */
 	if (restart != HRTIMER_NORESTART &&
-	    !(timer->state & HRTIMER_STATE_ENQUEUED))
+		!hrtimer_is_queued(timer))
 		enqueue_hrtimer(timer, base, HRTIMER_MODE_ABS);
 
 	/*
-- 
2.39.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ