From: Joe Perches <joe@perches.com>
To: Roland Dreier <roland@purestorage.com>,
Peter Zijlstra <a.p.zijlstra@chello.nl>,
Paul Mackerras <paulus@samba.org>, Ingo Molnar <mingo@redhat.com>,
Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Sylvain Munaut <s.munaut@whatever-company.com>,
Kay Sievers <kay@vrfy.org>,
Andrew Morton <akpm@linux-foundation.org>,
LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] printk: Fix incorrect length from print_time() when seconds > 99999
Date: Sat, 29 Dec 2012 19:07:48 -0800 [thread overview]
Message-ID: <1356836868.17061.7.camel@joe-AO722> (raw)
In-Reply-To: <CAL1RGDV5fje8+sNQUCgJNKaasZ=pvg4rWrXaz-3cZ+uNgsWDzg@mail.gmail.com>
On Sat, 2012-12-29 at 14:27 -0800, Roland Dreier wrote:
> On Sat, Dec 29, 2012 at 12:08 PM, Joe Perches <joe@perches.com> wrote:
> > Sylvan Munaut did something similar
> > https://lkml.org/lkml/2012/12/5/168
>
> Missed that and duplicated the debugging :(
> Sorry Sylvain.
>
> I guess my patch may be preferable, since I happened to use the snprintf()
> method that you suggest -- all the open-coded digit-counting seems a bit
> verbose and perhaps hard to read and see the equivalence to the sprintf.
the kernel implementation of snprint/vsnprintf does expand on c99
and allow snprintf(NULL, 0... so your code should work fine.
I think the
snprintf(NULL, 0
might be suspect.
(the same form is already used in drivers/usb/gadget/composite.c)
man snprintf says in part:
Concerning the return value of snprintf(), SUSv2 and C99 contradict
each other: when snprintf() is called with size=0 then SUSv2 stipulates
an unspecified return value less than 1, while C99 allows str to be
NULL in this case, and gives the return value (as always) as the number
of characters that would have been written in case the output string
has been large enough.
If not here, maybe the tools/perf/util/values.c code
that uses the same form might need changing.
next prev parent reply other threads:[~2012-12-30 3:08 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-12-29 4:23 Roland Dreier
2012-12-29 17:56 ` Greg Kroah-Hartman
2012-12-29 20:08 ` Joe Perches
2012-12-29 22:27 ` Roland Dreier
2012-12-30 3:07 ` Joe Perches [this message]
2012-12-31 14:45 ` Sylvain Munaut
2012-12-29 22:24 ` Roland Dreier
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1356836868.17061.7.camel@joe-AO722 \
--to=joe@perches.com \
--cc=a.p.zijlstra@chello.nl \
--cc=acme@ghostprotocols.net \
--cc=akpm@linux-foundation.org \
--cc=gregkh@linuxfoundation.org \
--cc=kay@vrfy.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=paulus@samba.org \
--cc=roland@purestorage.com \
--cc=s.munaut@whatever-company.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®