[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.DEB.1.10.0901062138520.25237@gandalf.stny.rr.com>
Date: Tue, 6 Jan 2009 21:42:17 -0500 (EST)
From: Steven Rostedt <rostedt@...dmis.org>
To: Andrew Morton <akpm@...ux-foundation.org>
cc: linux-kernel@...r.kernel.org, mingo@...e.hu, fweisbec@...il.com,
roel.kluin@...il.com, pq@....fi, srostedt@...hat.com
Subject: Re: [PATCH 1/3] ftrace: convert unsigned index to signed
On Tue, 6 Jan 2009, Andrew Morton wrote:
> On Tue, 06 Jan 2009 17:33:38 -0500
> Steven Rostedt <rostedt@...dmis.org> wrote:
>
> > From: Steven Rostedt <srostedt@...hat.com>
> >
> > Impact: fix to unsigned compared to less than zero
> >
> > Roel Kluin pointed out that there is a compare of an unsigned number
> > to less than zero. A previous clean up had the unsigned index set
> > to -1 for certain cases, but never converted it to signed.
> >
> > Frederic Weisbecker noticed that another index is used to compare
> > the above index to and it also needs to be converted to signed.
> >
> > Reported-by: Roel Kluin <roel.kluin@...il.com>
> > Reported-by: Frederic Weisbecker <fweisbec@...il.com>
> > Signed-off-by: Steven Rostedt <srostedt@...hat.com>
> > ---
> > kernel/trace/ftrace.c | 4 ++--
> > 1 files changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
> > index 2f32969..3576707 100644
> > --- a/kernel/trace/ftrace.c
> > +++ b/kernel/trace/ftrace.c
> > @@ -289,7 +289,7 @@ static DEFINE_MUTEX(ftrace_regex_lock);
> >
> > struct ftrace_page {
> > struct ftrace_page *next;
> > - unsigned long index;
> > + long index;
>
> Does that actually need to be a long type?
No, I think I just automatically typed "unsigned long" before, and here
I just removed the unsigned. It can also be an int. It only indexes what
is on a page.
>
> > struct dyn_ftrace records[];
> > };
> >
> > @@ -786,7 +786,7 @@ enum {
> >
> > struct ftrace_iterator {
> > struct ftrace_page *pg;
> > - unsigned idx;
> > + int idx;
>
> because we have
>
> if (iter->idx >= iter->pg->index) {
>
> Are 32-bit types actually more efficient than 64-bit types on any
> 64-bit hardware which we care about?
They both should always be way less than 2^31, so they both can be int.
Thanks, I'll fix this one up. I don't think Ingo pulled it yet.
-- Steve
--
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