lkml.org 
[lkml]   [2009]   [Mar]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] kernel/trace/trace_functions_graph.c: fix nsecs_str buffer size
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



\
 
 \ /
  Last update: 2009-03-23 18:01    [W:0.134 / U:0.048 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site