]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
tomoyo: Use sensible time interface
authorThomas Gleixner <tglx@linutronix.de>
Wed, 11 Jun 2014 23:59:19 +0000 (23:59 +0000)
committerThomas Gleixner <tglx@linutronix.de>
Thu, 12 Jun 2014 14:18:45 +0000 (16:18 +0200)
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
security/tomoyo/audit.c
security/tomoyo/common.c

index c1b00375c9ad8c23edcf27ab0f5b80820d0ad99e..3ffa4f5509d8c873c76cd8a3bb55b517df88537d 100644 (file)
@@ -155,11 +155,9 @@ static char *tomoyo_print_header(struct tomoyo_request_info *r)
        u8 i;
        if (!buffer)
                return NULL;
-       {
-               struct timeval tv;
-               do_gettimeofday(&tv);
-               tomoyo_convert_time(tv.tv_sec, &stamp);
-       }
+
+       tomoyo_convert_time(get_seconds(), &stamp);
+
        pos = snprintf(buffer, tomoyo_buffer_len - 1,
                       "#%04u/%02u/%02u %02u:%02u:%02u# profile=%u mode=%s "
                       "granted=%s (global-pid=%u) task={ pid=%u ppid=%u "
index 283862aebdc8376fa071422d03aa39dc39087b21..e0fb7505255090069e316e9e9408c34a96f13fe8 100644 (file)
@@ -2267,13 +2267,11 @@ static unsigned int tomoyo_stat_modified[TOMOYO_MAX_POLICY_STAT];
  */
 void tomoyo_update_stat(const u8 index)
 {
-       struct timeval tv;
-       do_gettimeofday(&tv);
        /*
         * I don't use atomic operations because race condition is not fatal.
         */
        tomoyo_stat_updated[index]++;
-       tomoyo_stat_modified[index] = tv.tv_sec;
+       tomoyo_stat_modified[index] = get_seconds();
 }
 
 /**