aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/audit.c
diff options
context:
space:
mode:
authorEric Paris <eparis@redhat.com>2014-01-13 15:42:16 -0500
committerEric Paris <eparis@redhat.com>2014-01-13 22:33:27 -0500
commitc81825dd6b2ab9dcbdbc5b3ae12cc724c550341d (patch)
treefd0af9304f1b7dfb898a1c4dba706fd8c780a0b0 /kernel/audit.c
parent8c8115faca28c7118e2a5b0153998710ea3e01c4 (diff)
audit: wait_for_auditd rework for readability
We had some craziness with signed to unsigned long casting which appears wholely unnecessary. Just use signed long. Even though 2 values of the math equation are unsigned longs the result is expected to be a signed long. So why keep casting the result to signed long? Just make it signed long and use it. We also remove the needless "timeout" variable. We already have the stack "sleep_time" variable. Just use that... Signed-off-by: Eric Paris <eparis@redhat.com>
Diffstat (limited to 'kernel/audit.c')
-rw-r--r--kernel/audit.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/kernel/audit.c b/kernel/audit.c
index 40b28b5183ea..57d47f08ed15 100644
--- a/kernel/audit.c
+++ b/kernel/audit.c
@@ -1281,21 +1281,20 @@ static inline void audit_get_stamp(struct audit_context *ctx,
1281/* 1281/*
1282 * Wait for auditd to drain the queue a little 1282 * Wait for auditd to drain the queue a little
1283 */ 1283 */
1284static unsigned long wait_for_auditd(unsigned long sleep_time) 1284static long wait_for_auditd(long sleep_time)
1285{ 1285{
1286 unsigned long timeout = sleep_time;
1287 DECLARE_WAITQUEUE(wait, current); 1286 DECLARE_WAITQUEUE(wait, current);
1288 set_current_state(TASK_UNINTERRUPTIBLE); 1287 set_current_state(TASK_UNINTERRUPTIBLE);
1289 add_wait_queue_exclusive(&audit_backlog_wait, &wait); 1288 add_wait_queue_exclusive(&audit_backlog_wait, &wait);
1290 1289
1291 if (audit_backlog_limit && 1290 if (audit_backlog_limit &&
1292 skb_queue_len(&audit_skb_queue) > audit_backlog_limit) 1291 skb_queue_len(&audit_skb_queue) > audit_backlog_limit)
1293 timeout = schedule_timeout(sleep_time); 1292 sleep_time = schedule_timeout(sleep_time);
1294 1293
1295 __set_current_state(TASK_RUNNING); 1294 __set_current_state(TASK_RUNNING);
1296 remove_wait_queue(&audit_backlog_wait, &wait); 1295 remove_wait_queue(&audit_backlog_wait, &wait);
1297 1296
1298 return timeout; 1297 return sleep_time;
1299} 1298}
1300 1299
1301/** 1300/**
@@ -1339,13 +1338,12 @@ struct audit_buffer *audit_log_start(struct audit_context *ctx, gfp_t gfp_mask,
1339 while (audit_backlog_limit 1338 while (audit_backlog_limit
1340 && skb_queue_len(&audit_skb_queue) > audit_backlog_limit + reserve) { 1339 && skb_queue_len(&audit_skb_queue) > audit_backlog_limit + reserve) {
1341 if (gfp_mask & __GFP_WAIT && audit_backlog_wait_time) { 1340 if (gfp_mask & __GFP_WAIT && audit_backlog_wait_time) {
1342 unsigned long sleep_time; 1341 long sleep_time;
1343 1342
1344 sleep_time = timeout_start + audit_backlog_wait_time - 1343 sleep_time = timeout_start + audit_backlog_wait_time - jiffies;
1345 jiffies; 1344 if (sleep_time > 0) {
1346 if ((long)sleep_time > 0) {
1347 sleep_time = wait_for_auditd(sleep_time); 1345 sleep_time = wait_for_auditd(sleep_time);
1348 if ((long)sleep_time > 0) 1346 if (sleep_time > 0)
1349 continue; 1347 continue;
1350 } 1348 }
1351 } 1349 }