Skip to content

Commit 77f4fa0

Browse files
committed
tomoyo: Use sensible time interface
There is no point in calling gettimeofday if only the seconds part of the timespec is used. Use get_seconds() instead. It's not only the proper interface it's also faster. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Acked-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp> Cc: John Stultz <john.stultz@linaro.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Kentaro Takeda <takedakn@nttdata.co.jp> Cc: linux-security-module@vger.kernel.org Link: http://lkml.kernel.org/r/20140611234607.775273584@linutronix.de
1 parent f037c11 commit 77f4fa0

2 files changed

Lines changed: 4 additions & 8 deletions

File tree

‎security/tomoyo/audit.c‎

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -155,11 +155,9 @@ static char *tomoyo_print_header(struct tomoyo_request_info *r)
155155
u8 i;
156156
if (!buffer)
157157
return NULL;
158-
{
159-
struct timeval tv;
160-
do_gettimeofday(&tv);
161-
tomoyo_convert_time(tv.tv_sec, &stamp);
162-
}
158+
159+
tomoyo_convert_time(get_seconds(), &stamp);
160+
163161
pos = snprintf(buffer, tomoyo_buffer_len - 1,
164162
"#%04u/%02u/%02u %02u:%02u:%02u# profile=%u mode=%s "
165163
"granted=%s (global-pid=%u) task={ pid=%u ppid=%u "

‎security/tomoyo/common.c‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2267,13 +2267,11 @@ static unsigned int tomoyo_stat_modified[TOMOYO_MAX_POLICY_STAT];
22672267
*/
22682268
void tomoyo_update_stat(const u8 index)
22692269
{
2270-
struct timeval tv;
2271-
do_gettimeofday(&tv);
22722270
/*
22732271
* I don't use atomic operations because race condition is not fatal.
22742272
*/
22752273
tomoyo_stat_updated[index]++;
2276-
tomoyo_stat_modified[index] = tv.tv_sec;
2274+
tomoyo_stat_modified[index] = get_seconds();
22772275
}
22782276

22792277
/**

0 commit comments

Comments
 (0)