On Mon, 14 Sep 2009, Rui Paulo wrote:

Log:
 Fix previous commit. I got it backwards.

It is still unfixed.

 MFC after:     1 week

Modified:
 head/sys/dev/asmc/asmc.c

Modified: head/sys/dev/asmc/asmc.c
==============================================================================
--- head/sys/dev/asmc/asmc.c    Mon Sep 14 16:13:12 2009        (r197194)
+++ head/sys/dev/asmc/asmc.c    Mon Sep 14 16:16:07 2009        (r197195)
@@ -824,7 +824,7 @@ out:
                type[5] = 0;
                if (maxlen > sizeof(v)) {
                        device_printf(dev, "WARNING: cropping maxlen "
-                           "from %u to %u\n", maxlen, sizeof(v));
+                           "from %u to %lu\n", maxlen, sizeof(v));
                        maxlen = sizeof(v);
                }

This printf has the following errors:

Fatal printf format error: values of type size_t should be printed
using %zu, but here sizeof(v) is printed using %lu.  Printing it using
%u would be fatal on different systems.

Non-fatal printf format error: maxlen has type uint8_t, so its default
promotion is int, and this should be printed using %d like it was 2
commits ago.  %u will work since the value is representable using both
int and u_int, but this is not easy to see (in fact, I can't see it
in C99 -- I can only see where C99 requires va_arg(ap, u_int) to work
on a u_int).

Format-printf error (style bug).  The message is obfuscated using C90
string concatenation.

Fixed version:

                        device_printf(dev,
                            "WARNING: cropping maxlen from %d to %zu\n",
                            maxlen, sizeof(v));

Bruce
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to