diff options
author | wuchi <wuchi.zero@gmail.com> | 2022-08-29 18:26:09 +0200 |
---|---|---|
committer | Paul Moore <paul@paul-moore.com> | 2022-08-30 01:47:03 +0200 |
commit | 501e4bb102ee2f380ab94abbf3d35dff9d4719a2 (patch) | |
tree | 0be19d6c734c597cbdd993d95220adbbb765bb23 /kernel/audit.c | |
parent | audit: free audit_proctitle only on task exit (diff) | |
download | linux-501e4bb102ee2f380ab94abbf3d35dff9d4719a2.tar.xz linux-501e4bb102ee2f380ab94abbf3d35dff9d4719a2.zip |
audit: use time_after to compare time
Using time_{*} macro to compare time is better
Signed-off-by: wuchi <wuchi.zero@gmail.com>
Signed-off-by: Paul Moore <paul@paul-moore.com>
Diffstat (limited to 'kernel/audit.c')
-rw-r--r-- | kernel/audit.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/kernel/audit.c b/kernel/audit.c index a75978ae38ad..9bc0b0301198 100644 --- a/kernel/audit.c +++ b/kernel/audit.c @@ -321,7 +321,6 @@ static inline int audit_rate_check(void) static DEFINE_SPINLOCK(lock); unsigned long flags; unsigned long now; - unsigned long elapsed; int retval = 0; if (!audit_rate_limit) return 1; @@ -330,9 +329,8 @@ static inline int audit_rate_check(void) if (++messages < audit_rate_limit) { retval = 1; } else { - now = jiffies; - elapsed = now - last_check; - if (elapsed > HZ) { + now = jiffies; + if (time_after(now, last_check + HZ)) { last_check = now; messages = 0; retval = 1; @@ -366,7 +364,7 @@ void audit_log_lost(const char *message) if (!print) { spin_lock_irqsave(&lock, flags); now = jiffies; - if (now - last_msg > HZ) { + if (time_after(now, last_msg + HZ)) { print = 1; last_msg = now; } |