Re: [PATCH 1/3] ftrace: convert unsigned index to signed

From: Andrew Morton
Date: Tue Jan 06 2009 - 17:52:58 EST


On Tue, 06 Jan 2009 17:33:38 -0500
Steven Rostedt <rostedt@xxxxxxxxxxx> wrote:

> From: Steven Rostedt <srostedt@xxxxxxxxxx>
>
> 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@xxxxxxxxx>
> Reported-by: Frederic Weisbecker <fweisbec@xxxxxxxxx>
> Signed-off-by: Steven Rostedt <srostedt@xxxxxxxxxx>
> ---
> 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?

> 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?
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/