From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15922 invoked by alias); 5 Feb 2010 16:52:44 -0000 Received: (qmail 15915 invoked by uid 22791); 5 Feb 2010 16:52:44 -0000 X-SWARE-Spam-Status: No, hits=-2.5 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 05 Feb 2010 16:52:40 +0000 Received: from int-mx08.intmail.prod.int.phx2.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o15Gqd9m017142 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Fri, 5 Feb 2010 11:52:39 -0500 Received: from [10.16.2.46] (dhcp-100-2-46.bos.redhat.com [10.16.2.46]) by int-mx08.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o15Gqbdp020652; Fri, 5 Feb 2010 11:52:38 -0500 Message-ID: <4B6C4CD5.8010800@redhat.com> Date: Fri, 05 Feb 2010 16:52:00 -0000 From: Masami Hiramatsu User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.7) Gecko/20100120 Fedora/3.0.1-1.fc11 Thunderbird/3.0.1 MIME-Version: 1.0 To: Ingo Molnar CC: lkml , systemtap , DLE Subject: Re: [PATCH -tip 1/2] x86/alternatives: Fix build warning References: <20100205062427.3745.85746.stgit@dhcp-100-2-132.bos.redhat.com> <20100205071249.GB9320@elte.hu> In-Reply-To: <20100205071249.GB9320@elte.hu> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Mailing-List: contact systemtap-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: systemtap-owner@sourceware.org X-SW-Source: 2010-q1/txt/msg00343.txt.bz2 Ingo Molnar wrote: > > * Masami Hiramatsu 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 >> Reported-by: Ingo Molnar >> --- >> >> 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. I doubt this type casting is dangerous..., but yeah, it's ugly :-) > 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. Sure, I'll update it. Thank you, -- Masami Hiramatsu Software Engineer Hitachi Computer Products (America), Inc. Software Solutions Division e-mail: mhiramat@redhat.com