diff options
author | Thomas Gleixner <tglx@linutronix.de> | 2014-06-11 19:59:19 -0400 |
---|---|---|
committer | Thomas Gleixner <tglx@linutronix.de> | 2014-06-12 10:18:45 -0400 |
commit | 77f4fa089c724adc3a87c10eb031bca91b144ac0 (patch) | |
tree | 1e40795801937aeb9f69ec6a2458a1c1571b13f7 /security | |
parent | f037c1171db79be2a047b1a5aafa2fd1f05051cb (diff) |
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
Diffstat (limited to 'security')
-rw-r--r-- | security/tomoyo/audit.c | 8 | ||||
-rw-r--r-- | security/tomoyo/common.c | 4 |
2 files changed, 4 insertions, 8 deletions
diff --git a/security/tomoyo/audit.c b/security/tomoyo/audit.c index c1b00375c9ad..3ffa4f5509d8 100644 --- a/security/tomoyo/audit.c +++ b/security/tomoyo/audit.c | |||
@@ -155,11 +155,9 @@ static char *tomoyo_print_header(struct tomoyo_request_info *r) | |||
155 | u8 i; | 155 | u8 i; |
156 | if (!buffer) | 156 | if (!buffer) |
157 | return NULL; | 157 | return NULL; |
158 | { | 158 | |
159 | struct timeval tv; | 159 | tomoyo_convert_time(get_seconds(), &stamp); |
160 | do_gettimeofday(&tv); | 160 | |
161 | tomoyo_convert_time(tv.tv_sec, &stamp); | ||
162 | } | ||
163 | pos = snprintf(buffer, tomoyo_buffer_len - 1, | 161 | pos = snprintf(buffer, tomoyo_buffer_len - 1, |
164 | "#%04u/%02u/%02u %02u:%02u:%02u# profile=%u mode=%s " | 162 | "#%04u/%02u/%02u %02u:%02u:%02u# profile=%u mode=%s " |
165 | "granted=%s (global-pid=%u) task={ pid=%u ppid=%u " | 163 | "granted=%s (global-pid=%u) task={ pid=%u ppid=%u " |
diff --git a/security/tomoyo/common.c b/security/tomoyo/common.c index 283862aebdc8..e0fb75052550 100644 --- a/security/tomoyo/common.c +++ b/security/tomoyo/common.c | |||
@@ -2267,13 +2267,11 @@ static unsigned int tomoyo_stat_modified[TOMOYO_MAX_POLICY_STAT]; | |||
2267 | */ | 2267 | */ |
2268 | void tomoyo_update_stat(const u8 index) | 2268 | void tomoyo_update_stat(const u8 index) |
2269 | { | 2269 | { |
2270 | struct timeval tv; | ||
2271 | do_gettimeofday(&tv); | ||
2272 | /* | 2270 | /* |
2273 | * I don't use atomic operations because race condition is not fatal. | 2271 | * I don't use atomic operations because race condition is not fatal. |
2274 | */ | 2272 | */ |
2275 | tomoyo_stat_updated[index]++; | 2273 | tomoyo_stat_updated[index]++; |
2276 | tomoyo_stat_modified[index] = tv.tv_sec; | 2274 | tomoyo_stat_modified[index] = get_seconds(); |
2277 | } | 2275 | } |
2278 | 2276 | ||
2279 | /** | 2277 | /** |