public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Daniel Mack <daniel@caiaq.de>
To: Frederic Weisbecker <fweisbec@gmail.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] kernel/trace/trace_functions_graph.c: fix nsecs_str buffer size
Date: Mon, 23 Mar 2009 17:57:20 +0100	[thread overview]
Message-ID: <20090323165720.GC5393@buzzloop.caiaq.de> (raw)
In-Reply-To: <20090323164030.GA5988@nowhere>

Hi Frederic,

On Mon, Mar 23, 2009 at 05:40:31PM +0100, Frederic Weisbecker wrote:
> It can't really happen because nsecs_rem is a rest of a division
> per 1000, so it will not exceed 3 digits (so it should be [4] and not
> [5], btw).
> 
> I must confess I should have added a better comment on this
> area.
> 
> We are printing a duration in usec with a part in nsec with the following
> constraints:
> 
> _ never exceed 7 characters unless we are are upper 9999999 usecs
> _ always keep the usecs consistants
> 
> Which means that while we have 4 or lesser digits for the usecs, we can
> print the 3 digits of the nanosecs.
> 
> If we need 5 for usecs, drop the least significant nanosec digit.
> If we need 6 for usecs, drop the two least significant nanosec digits

Ok, I see. I was just confused about the max len argument to snprintf()
(and so was cppcheck), but at a closer look, this can't become a
problem.

Nevermind, drop the patch - but good that we talked about it :)

Daniel


  reply	other threads:[~2009-03-23 16:57 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-23 16:10 [PATCH] kernel/trace/trace_functions_graph.c: fix nsecs_str buffer size Daniel Mack
2009-03-23 16:40 ` Frederic Weisbecker
2009-03-23 16:57   ` Daniel Mack [this message]
2009-03-23 16:42 ` [tip:tracing/ftrace] " Daniel Mack
2009-03-23 16:47   ` Frederic Weisbecker
2009-03-23 17:15     ` Ingo Molnar

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=20090323165720.GC5393@buzzloop.caiaq.de \
    --to=daniel@caiaq.de \
    --cc=fweisbec@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    /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