From owner-svn-src-all@FreeBSD.ORG Mon Sep 14 18:30:21 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AFD2D1065672; Mon, 14 Sep 2009 18:30:21 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail05.syd.optusnet.com.au (mail05.syd.optusnet.com.au [211.29.132.186]) by mx1.freebsd.org (Postfix) with ESMTP id 352A18FC0C; Mon, 14 Sep 2009 18:30:20 +0000 (UTC) Received: from c122-107-125-150.carlnfd1.nsw.optusnet.com.au (c122-107-125-150.carlnfd1.nsw.optusnet.com.au [122.107.125.150]) by mail05.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id n8EIUHOP025921 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 15 Sep 2009 04:30:18 +1000 Date: Tue, 15 Sep 2009 04:30:17 +1000 (EST) From: Bruce Evans X-X-Sender: bde@delplex.bde.org To: Rui Paulo In-Reply-To: <200909141616.n8EGG8r3059684@svn.freebsd.org> Message-ID: <20090915040529.J6194@delplex.bde.org> References: <200909141616.n8EGG8r3059684@svn.freebsd.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r197195 - head/sys/dev/asmc X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 14 Sep 2009 18:30:21 -0000 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