security/integrity/ima/ima_policy.c: use %pU to output UUID in printable format
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Sat, 21 May 2016 00:00:57 +0000 (17:00 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Sat, 21 May 2016 00:58:30 +0000 (17:58 -0700)
Instead of open coded variant re-use extension that vsprintf.c provides
us for ages.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Matt Fleming <matt@codeblueprint.co.uk>
Cc: Dmitry Kasatkin <dmitry.kasatkin@gmail.com>
Cc: Mimi Zohar <zohar@linux.vnet.ibm.com>
Cc: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: "Theodore Ts'o" <tytso@mit.edu>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
security/integrity/ima/ima_policy.c

index 3cd0a58672dd1df684e12d0a4331b56fd4fa12fb..0f887a564a29f982f6b3a8483b3f730b0a71098d 100644 (file)
@@ -972,7 +972,7 @@ static void policy_func_show(struct seq_file *m, enum ima_hooks func)
 int ima_policy_show(struct seq_file *m, void *v)
 {
        struct ima_rule_entry *entry = v;
-       int i = 0;
+       int i;
        char tbuf[64] = {0,};
 
        rcu_read_lock();
@@ -1012,17 +1012,7 @@ int ima_policy_show(struct seq_file *m, void *v)
        }
 
        if (entry->flags & IMA_FSUUID) {
-               seq_puts(m, "fsuuid=");
-               for (i = 0; i < ARRAY_SIZE(entry->fsuuid); ++i) {
-                       switch (i) {
-                       case 4:
-                       case 6:
-                       case 8:
-                       case 10:
-                               seq_puts(m, "-");
-                       }
-                       seq_printf(m, "%x", entry->fsuuid[i]);
-               }
+               seq_printf(m, "fsuuid=%pU", entry->fsuuid);
                seq_puts(m, " ");
        }