Currently clang ignores the "kprintf" format attribute.  I've got a
fix for that, but with that fix it complains about the code fixed in
the diff below.

Now our manual page says:

     The kernel functions don't support as many formatting specifiers as their
     user space counterparts.  In addition to the floating point formatting
     specifiers, the following integer type specifiers are not supported:

     %hh    Argument of char type.  This format specifier is accepted by the
            kernel but will be handled as %h.

So as far as the kernel is concerned, this change is a no-op.


P.S. While printing as a short is technically incorrect, it works
     because the arguments are unsigned and promoted to int.

Index: subr_disk.c
RCS file: /cvs/src/sys/kern/subr_disk.c,v
retrieving revision 1.230
diff -u -p -r1.230 subr_disk.c
--- subr_disk.c 4 May 2017 22:47:27 -0000       1.230
+++ subr_disk.c 3 Aug 2017 17:38:32 -0000
@@ -1864,7 +1864,7 @@ duid_format(u_char *duid)
        static char duid_str[17];
        snprintf(duid_str, sizeof(duid_str),
-           "%02hx%02hx%02hx%02hx%02hx%02hx%02hx%02hx",
+           "%02hhx%02hhx%02hhx%02hhx%02hhx%02hhx%02hhx%02hhx",
            duid[0], duid[1], duid[2], duid[3],
            duid[4], duid[5], duid[6], duid[7]);

Reply via email to