[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20120307152848.562c72f2@wrlaptop>
Date: Wed, 7 Mar 2012 15:28:48 -0600
From: Peter Seebach <peter.seebach@...driver.com>
To: Peter Zijlstra <peterz@...radead.org>
CC: Ingo Molnar <mingo@...e.hu>,
Arnaldo Carvalho de Melo <acme@...hat.com>,
Anton Blanchard <anton@...ba.org>, <paulus@...ba.org>,
<dsahern@...il.com>, <fweisbec@...il.com>,
<yanmin_zhang@...ux.intel.com>, <emunson@...bm.net>,
<linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] perf: Incorrect use of snprintf results in SEGV
On Wed, 7 Mar 2012 21:59:24 +0100
Peter Zijlstra <peterz@...radead.org> wrote:
> On Wed, 2012-03-07 at 21:37 +0100, Ingo Molnar wrote:
> > size_needed = snprintf_size(...);
>
> This would require 3 passes over the fmt+args, first to find the
> allocated size is insufficient, 2nd to compute the size, 3rd to fill
> buffer.
>
> Whereas with the current "creative" API only 2 passes are needed.
>
> I can imagine that back in the day of small memory and small CPU this
> was deemed important enough.
It occurs to me that I have seen this discussion, or a variant, before:
http://coding.derkeiler.com/Archive/C_CPP/comp.lang.c/2004-11/2332.html
In which people discuss the possible alternative return values at some
length.
-s
--
Listen, get this. Nobody with a good compiler needs to be justified.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists