From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754578AbbIQJdK (ORCPT ); Thu, 17 Sep 2015 05:33:10 -0400 Received: from mail.windriver.com ([147.11.1.11]:49608 "EHLO mail.windriver.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754300AbbIQJdI (ORCPT ); Thu, 17 Sep 2015 05:33:08 -0400 Message-ID: <55FA88BD.3050303@windriver.com> Date: Thu, 17 Sep 2015 17:32:45 +0800 From: yjin User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.6.0 MIME-Version: 1.0 To: Minfei Huang CC: , , , , Subject: Re: [PATCH] vmcore: replace Elf64_Ehdr/Elf32_Ehdr with elfhdr References: <1442372321-16334-1-git-send-email-yanjiang.jin@windriver.com> <1442372321-16334-2-git-send-email-yanjiang.jin@windriver.com> <20150916103917.GA32189@dhcp-128-25.nay.redhat.com> In-Reply-To: <20150916103917.GA32189@dhcp-128-25.nay.redhat.com> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2015年09月16日 18:39, Minfei Huang wrote: > On 09/16/15 at 10:58am, yanjiang.jin@windriver.com wrote: >> From: Yanjiang Jin >> >> Function parse_crash_elf_headers() reads e_ident[EI_CLASS] then decides to >> call parse_crash_elf64_headers() or parse_crash_elf32_headers(). >> But this happens in run time, not compile time. So compiler will report >> the below warning: >> >> In file included from include/linux/elf.h:4:0, >> from fs/proc/vmcore.c:13: >> fs/proc/vmcore.c: In function 'parse_crash_elf32_headers': >> arch/mips/include/asm/elf.h:258:23: warning: initializatio >> n from incompatible pointer type >> struct elfhdr *__h = (hdr); \ >> ^ > How about converting the hdr to type elfhdr in above sentence, like > following. > > struct elfhdr *__h = (struct elfhdr *)(hdr); Yes, this is a replacement, and it seems more safe because it just affects MIPS arch. But I also can't see any obvious impact if modifying common vmcore.c:-) Anyway, if you stick to your opinion, I can send a V2 patch to update mips' elf.h rather than vmcore.c. Thanks! Yanjiang > > Thanks > Minfei > >> fs/proc/vmcore.c:1071:4: note: in expansion of macro 'elf_ >> check_arch' >> !elf_check_arch(&ehdr) || >> ^ >> >> Signed-off-by: Yanjiang Jin >> --- >> fs/proc/vmcore.c | 4 ++-- >> 1 file changed, 2 insertions(+), 2 deletions(-) >> >> diff --git a/fs/proc/vmcore.c b/fs/proc/vmcore.c >> index 4e61388..576bb26 100644 >> --- a/fs/proc/vmcore.c >> +++ b/fs/proc/vmcore.c >> @@ -999,7 +999,7 @@ static void free_elfcorebuf(void) >> static int __init parse_crash_elf64_headers(void) >> { >> int rc=0; >> - Elf64_Ehdr ehdr; >> + struct elfhdr ehdr; >> u64 addr; >> >> addr = elfcorehdr_addr; >> @@ -1055,7 +1055,7 @@ fail: >> static int __init parse_crash_elf32_headers(void) >> { >> int rc=0; >> - Elf32_Ehdr ehdr; >> + struct elfhdr ehdr; >> u64 addr; >> >> addr = elfcorehdr_addr;