[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <AANLkTik4J=tWtdcCogfLqeFwnP_YkORfkntR8rg7NGBc@mail.gmail.com>
Date: Sat, 16 Oct 2010 18:32:40 +0200
From: Geert Uytterhoeven <geert@...ux-m68k.org>
To: Ingo Molnar <mingo@...e.hu>
Cc: Steven Rostedt <rostedt@...dmis.org>,
Frederic Weisbecker <fweisbec@...il.com>,
Robin Holt <holt@....com>, Ingo Molnar <mingo@...hat.com>,
linux-kernel@...r.kernel.org
Subject: Re: ftrace does not work on cpus > 999.
On Sat, Oct 16, 2010 at 18:16, Ingo Molnar <mingo@...e.hu> wrote:
> * Steven Rostedt <rostedt@...dmis.org> wrote:
>
>> On Sat, 2010-10-16 at 16:45 +0200, Frederic Weisbecker wrote:
>>
>> > diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
>> > index 9ec59f5..3565f9e 100644
>> > --- a/kernel/trace/trace.c
>> > +++ b/kernel/trace/trace.c
>> > @@ -3999,7 +3999,7 @@ static void tracing_init_debugfs_percpu(long cpu)
>> > /* strlen(cpu) + MAX(log10(cpu)) + '\0' */
>> > char cpu_dir[7];
>> >
>> > - if (cpu > 999 || cpu < 0)
>> > + if (cpu < 0)
>> > return;
>> >
>> > sprintf(cpu_dir, "cpu%ld", cpu);
>>
>> You need to change the size of cpu_dir, otherwise this will overflow.
>
> If you change it to 30 that ought to be enough, as long as cpu_id's fit
Yep.
> into u64. (I think we wont overflow that in my lifetime.)
>> The other case is to dynamically allocate cpu_dir.
>
> Please tell me that is a joke ...
And if it isn't, use kasprintf() ;-)
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@...ux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
--
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