Messages in this thread | | | Date | Tue, 6 Jan 2009 21:42:17 -0500 (EST) | From | Steven Rostedt <> | 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@goodmis.org> wrote: > > > From: Steven Rostedt <srostedt@redhat.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@gmail.com> > > Reported-by: Frederic Weisbecker <fweisbec@gmail.com> > > Signed-off-by: Steven Rostedt <srostedt@redhat.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
| |