mirror of
https://github.com/tbsdtv/linux_media.git
synced 2025-07-23 04:33:26 +02:00
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>
This commit is contained in:
@@ -321,7 +321,6 @@ static inline int audit_rate_check(void)
|
|||||||
static DEFINE_SPINLOCK(lock);
|
static DEFINE_SPINLOCK(lock);
|
||||||
unsigned long flags;
|
unsigned long flags;
|
||||||
unsigned long now;
|
unsigned long now;
|
||||||
unsigned long elapsed;
|
|
||||||
int retval = 0;
|
int retval = 0;
|
||||||
|
|
||||||
if (!audit_rate_limit) return 1;
|
if (!audit_rate_limit) return 1;
|
||||||
@@ -331,8 +330,7 @@ static inline int audit_rate_check(void)
|
|||||||
retval = 1;
|
retval = 1;
|
||||||
} else {
|
} else {
|
||||||
now = jiffies;
|
now = jiffies;
|
||||||
elapsed = now - last_check;
|
if (time_after(now, last_check + HZ)) {
|
||||||
if (elapsed > HZ) {
|
|
||||||
last_check = now;
|
last_check = now;
|
||||||
messages = 0;
|
messages = 0;
|
||||||
retval = 1;
|
retval = 1;
|
||||||
@@ -366,7 +364,7 @@ void audit_log_lost(const char *message)
|
|||||||
if (!print) {
|
if (!print) {
|
||||||
spin_lock_irqsave(&lock, flags);
|
spin_lock_irqsave(&lock, flags);
|
||||||
now = jiffies;
|
now = jiffies;
|
||||||
if (now - last_msg > HZ) {
|
if (time_after(now, last_msg + HZ)) {
|
||||||
print = 1;
|
print = 1;
|
||||||
last_msg = now;
|
last_msg = now;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user