2007-01-30 05:45:57

by Kumar Gala

[permalink] [raw]
Subject: [PATCH] kprobes: Fix compiler warning

On ppc the compiler gripes about:

kernel/kprobes.c: In function 'collect_garbage_slots':
kernel/kprobes.c:215: warning: comparison is always false due to limited range of data type

The compiler ends up optimizing away the test since char's are unsigned on ppc.

Signed-off-by: Kumar Gala <[email protected]>

---
commit 1ee2dc5300b1c454f92eeea82da300f72db1b26f
tree c73cdacb43e154292708d967e11b1cbf7ab4904f
parent c0d4d573feed199b16094c072e7cb07afb01c598
author Kumar Gala <[email protected]> Mon, 29 Jan 2007 23:38:11 -0600
committer Kumar Gala <[email protected]> Mon, 29 Jan 2007 23:38:11 -0600

kernel/kprobes.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/kernel/kprobes.c b/kernel/kprobes.c
index 17ec4af..514276f 100644
--- a/kernel/kprobes.c
+++ b/kernel/kprobes.c
@@ -212,7 +212,7 @@ static int __kprobes collect_garbage_slots(void)
continue;
kip->ngarbage = 0; /* we will collect all garbages */
for (i = 0; i < INSNS_PER_PAGE; i++) {
- if (kip->slot_used[i] == -1 &&
+ if (kip->slot_used[i] == (char)-1 &&
collect_one_slot(kip, i))
break;
}


Subject: Re: [PATCH] kprobes: Fix compiler warning

On Mon, Jan 29, 2007 at 11:43:33PM -0600, Kumar Gala wrote:
> On ppc the compiler gripes about:
>
> kernel/kprobes.c: In function 'collect_garbage_slots':
> kernel/kprobes.c:215: warning: comparison is always false due to limited
> range of data type
>
> The compiler ends up optimizing away the test since char's are unsigned on
> ppc.

Kumar,

Masami fixed this last week:

http://marc.theaimsgroup.com/?l=linux-kernel&m=116968723823366&w=2

Patch currently in -mm.

Thanks,
Ananth

>
> Signed-off-by: Kumar Gala <[email protected]>
>
> ---
> commit 1ee2dc5300b1c454f92eeea82da300f72db1b26f
> tree c73cdacb43e154292708d967e11b1cbf7ab4904f
> parent c0d4d573feed199b16094c072e7cb07afb01c598
> author Kumar Gala <[email protected]> Mon, 29 Jan 2007 23:38:11
> -0600
> committer Kumar Gala <[email protected]> Mon, 29 Jan 2007 23:38:11
> -0600
>
> kernel/kprobes.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/kernel/kprobes.c b/kernel/kprobes.c
> index 17ec4af..514276f 100644
> --- a/kernel/kprobes.c
> +++ b/kernel/kprobes.c
> @@ -212,7 +212,7 @@ static int __kprobes collect_garbage_slots(void)
> continue;
> kip->ngarbage = 0; /* we will collect all garbages */
> for (i = 0; i < INSNS_PER_PAGE; i++) {
> - if (kip->slot_used[i] == -1 &&
> + if (kip->slot_used[i] == (char)-1 &&
> collect_one_slot(kip, i))
> break;
> }

2007-01-30 07:06:45

by Kumar Gala

[permalink] [raw]
Subject: Re: [PATCH] kprobes: Fix compiler warning


On Jan 29, 2007, at 11:55 PM, Ananth N Mavinakayanahalli wrote:

> On Mon, Jan 29, 2007 at 11:43:33PM -0600, Kumar Gala wrote:
>> On ppc the compiler gripes about:
>>
>> kernel/kprobes.c: In function 'collect_garbage_slots':
>> kernel/kprobes.c:215: warning: comparison is always false due to
>> limited
>> range of data type
>>
>> The compiler ends up optimizing away the test since char's are
>> unsigned on
>> ppc.
>
> Kumar,
>
> Masami fixed this last week:
>
> http://marc.theaimsgroup.com/?l=linux-kernel&m=116968723823366&w=2
>
> Patch currently in -mm.
>
> Thanks,
> Ananth

Cool, Masami's patch looks far more complete.

- k

2007-01-30 07:13:14

by Kumar Gala

[permalink] [raw]
Subject: Re: [PATCH] kprobes: Fix compiler warning


On Jan 30, 2007, at 1:05 AM, Kumar Gala wrote:

>
> On Jan 29, 2007, at 11:55 PM, Ananth N Mavinakayanahalli wrote:
>
>> On Mon, Jan 29, 2007 at 11:43:33PM -0600, Kumar Gala wrote:
>>> On ppc the compiler gripes about:
>>>
>>> kernel/kprobes.c: In function 'collect_garbage_slots':
>>> kernel/kprobes.c:215: warning: comparison is always false due to
>>> limited
>>> range of data type
>>>
>>> The compiler ends up optimizing away the test since char's are
>>> unsigned on
>>> ppc.
>>
>> Kumar,
>>
>> Masami fixed this last week:
>>
>> http://marc.theaimsgroup.com/?l=linux-kernel&m=116968723823366&w=2
>>
>> Patch currently in -mm.
>>
>> Thanks,
>> Ananth
>
> Cool, Masami's patch looks far more complete.

Andrew,

What are your thoughts on forward Masami patch to Linus for 2.6.20
since it fixes a real bug on PPC?

- k

2007-01-30 07:41:53

by Andrew Morton

[permalink] [raw]
Subject: Re: [PATCH] kprobes: Fix compiler warning

On Tue, 30 Jan 2007 01:12:17 -0600
Kumar Gala <[email protected]> wrote:

> What are your thoughts on forward Masami patch to Linus for 2.6.20
> since it fixes a real bug on PPC?

I bumped it up into the for-2.6.20 slot.

2007-01-31 00:05:57

by Kumar Gala

[permalink] [raw]
Subject: Re: [PATCH] kprobes: Fix compiler warning


On Jan 30, 2007, at 1:41 AM, Andrew Morton wrote:

> On Tue, 30 Jan 2007 01:12:17 -0600
> Kumar Gala <[email protected]> wrote:
>
>> What are your thoughts on forward Masami patch to Linus for 2.6.20
>> since it fixes a real bug on PPC?
>
> I bumped it up into the for-2.6.20 slot.

thanks.

- k