public inbox for systemtap@sourceware.org
 help / color / mirror / Atom feed
From: Ingo Molnar <mingo@elte.hu>
To: Masami Hiramatsu <mhiramat@redhat.com>
Cc: lkml <linux-kernel@vger.kernel.org>,
		systemtap <systemtap@sources.redhat.com>,
		DLE <dle-develop@lists.sourceforge.net>
Subject: Re: [PATCH -tip 1/2] x86/alternatives: Fix build warning
Date: Fri, 05 Feb 2010 07:13:00 -0000	[thread overview]
Message-ID: <20100205071249.GB9320@elte.hu> (raw)
In-Reply-To: <20100205062427.3745.85746.stgit@dhcp-100-2-132.bos.redhat.com>


* Masami Hiramatsu <mhiramat@redhat.com> wrote:

> Fixes below warnings.
> 
> ====
> FYI, there's this new build warning on x86 defconfig:
> 
> arch/x86/kernel/alternative.c: In function 'alternatives_text_reserved':
> arch/x86/kernel/alternative.c:402: warning: comparison of distinct pointer types lacks a cast
> arch/x86/kernel/alternative.c:402: warning: comparison of distinct pointer types lacks a cast
> arch/x86/kernel/alternative.c:405: warning: comparison of distinct pointer types lacks a cast
> arch/x86/kernel/alternative.c:405: warning: comparison of distinct pointer types lacks a cast
> 
> Caused by:
> 
> 2cfa197: ftrace/alternatives: Introducing *_text_reserved functions
> ====
> 
> Signed-off-by: Masami Hiramatsu <mhiramat@redhat.com>
> Reported-by: Ingo Molnar <mingo@elte.hu>
> ---
> 
>  arch/x86/kernel/alternative.c |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/x86/kernel/alternative.c b/arch/x86/kernel/alternative.c
> index 3832fdc..99d9920 100644
> --- a/arch/x86/kernel/alternative.c
> +++ b/arch/x86/kernel/alternative.c
> @@ -399,10 +399,10 @@ int alternatives_text_reserved(void *start, void *end)
>  	u8 **ptr;
>  
>  	list_for_each_entry(mod, &smp_alt_modules, next) {
> -		if (mod->text > end || mod->text_end < start)
> +		if (mod->text > (u8 *)end || mod->text_end < (u8 *)start)
>  			continue;
>  		for (ptr = mod->locks; ptr < mod->locks_end; ptr++)
> -			if (start <= *ptr && end >= *ptr)
> +			if ((u8 *)start <= *ptr && (u8 *)end >= *ptr)
>  				return 1;
>  	}

Such casts are a bit ugly and in general type casts are somewhat dangerous.

One possible solution would be to add intermediary local variables 
(text_start/text_end) with u8 * type and assign start/end to them - which can 
be done without a cast.

Thanks,

	Ingo

  parent reply	other threads:[~2010-02-05  7:13 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-05  6:16 Masami Hiramatsu
2010-02-05  6:16 ` [PATCH -tip 2/2] kprobes: Add mcount in kprobes blacklist Masami Hiramatsu
2010-02-05  7:51   ` [tip:perf/core] kprobes: Add mcount to the " tip-bot for Masami Hiramatsu
2010-02-15  5:23   ` [tip:tracing/urgent] " tip-bot for Masami Hiramatsu
2010-02-05  7:13 ` Ingo Molnar [this message]
2010-02-05 16:52   ` [PATCH -tip 1/2] x86/alternatives: Fix build warning Masami Hiramatsu
2010-02-05 17:09   ` [PATCH -tip v2] " Masami Hiramatsu
2010-02-07 19:44     ` [tip:perf/core] " tip-bot for Masami Hiramatsu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100205071249.GB9320@elte.hu \
    --to=mingo@elte.hu \
    --cc=dle-develop@lists.sourceforge.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mhiramat@redhat.com \
    --cc=systemtap@sources.redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).