Received: from mail.windriver.com (147.11.1.11) by ALA-HCA.corp.ad.wrs.com
 (147.11.189.50) with Microsoft SMTP Server (TLS) id 14.3.235.1; Thu, 17 Sep
 2015 22:48:40 -0700
Received: from mr1.windriver.com (mr1 [192.124.127.25])	by mail.windriver.com
 (8.15.2/8.15.1) with ESMTPS id t8I5mdRw027909	(version=TLSv1.1
 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK)	for
 <yanjiang.jin@windriver.com>; Thu, 17 Sep 2015 22:48:40 -0700 (PDT)
Received: from esa4.edoxs1.iphmx.com (esa4.edoxs1.iphmx.com [68.232.137.184])
	by mr1.windriver.com (8.15.2/8.15.1) with ESMTPS id t8I5mdrg023626
	(version=TLSv1 cipher=DHE-RSA-CAMELLIA256-SHA bits=256 verify=FAIL)	for
 <yanjiang.jin@windriver.com>; Thu, 17 Sep 2015 22:48:39 -0700
X-IronPort-Anti-Spam-Filtered: true
X-IronPort-Anti-Spam-Result: A0CPAAAopftVnBy3hNFdGQEBAYNbab1CAQ2BUB8KhXkCgUc4FAEBAQEBAQERAQEBAQEGDQkJIS6EIwEBAQECAQEBASAPATsLBQsLFQMCAgUhAgIPBRMBNROIJggNtmOUMgEBAQEBAQQBAQEBAQEBG4EihVGEfYUNB4JpL4EUBY1xh3GFEYUTgl+BUUaDb4MhhVmDZIRMg20fAQGCUxyBYTEziW0BAQE
X-IPAS-Result: A0CPAAAopftVnBy3hNFdGQEBAYNbab1CAQ2BUB8KhXkCgUc4FAEBAQEBAQERAQEBAQEGDQkJIS6EIwEBAQECAQEBASAPATsLBQsLFQMCAgUhAgIPBRMBNROIJggNtmOUMgEBAQEBAQQBAQEBAQEBG4EihVGEfYUNB4JpL4EUBY1xh3GFEYUTgl+BUUaDb4MhhVmDZIRMg20fAQGCUxyBYTEziW0BAQE
X-IronPort-AV: E=Sophos;i="5.17,550,1437462000"; 
   d="scan'208";a="40394617"
Received: from mx1.redhat.com ([209.132.183.28])  by esa4.edoxs1.iphmx.com
 with ESMTP/TLS/DHE-RSA-AES256-SHA; 17 Sep 2015 22:48:33 -0700
Received: from int-mx14.intmail.prod.int.phx2.redhat.com
 (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27])	by mx1.redhat.com
 (Postfix) with ESMTPS id 31FEE3B3C7;	Fri, 18 Sep 2015 05:48:33 +0000 (UTC)
Received: from localhost (unused [10.66.128.25] (may be forged))	by
 int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id
 t8I5mVeY026443;	Fri, 18 Sep 2015 01:48:32 -0400
Date: Fri, 18 Sep 2015 13:49:07 +0800
From: Minfei Huang <mhuang@redhat.com>
To: yjin <yanjiang.jin@windriver.com>
CC: <kexec@lists.infradead.org>, <akpm@linux-foundation.org>,
	<jinyanjiang@gmail.com>, <linux-kernel@vger.kernel.org>,
	<chaowang@redhat.com>
Subject: Re: [PATCH] vmcore: replace Elf64_Ehdr/Elf32_Ehdr with elfhdr
Message-ID: <20150918054907.GA6349@dhcp-128-25.nay.redhat.com>
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>
 <55FA88BD.3050303@windriver.com>
Content-Type: text/plain; charset="utf-8"
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
In-Reply-To: <55FA88BD.3050303@windriver.com>
User-Agent: Mutt/1.5.21 (2010-09-15)
X-Scanned-By: MIMEDefang 2.68 on 10.5.11.27
Return-Path: mhuang@redhat.com
X-MS-Exchange-Organization-AuthSource: ALA-HCA.corp.ad.wrs.com
X-MS-Exchange-Organization-AuthAs: Anonymous
MIME-Version: 1.0

On 09/17/15 at 05:32pm, yjin wrote:
> 
> On 2015年09月16日 18:39, Minfei Huang wrote:
> >On 09/16/15 at 10:58am, yanjiang.jin@windriver.com wrote:
> >>From: Yanjiang Jin <yanjiang.jin@windriver.com>
> >>
> >>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:-)

Without the Maro define, elfhdr is not the struct in the code source.
Thus there is some unconvenience for people to read the code, if there
is another thought to fix this issue. 

Please do the converting in the Maro, and repost the new version.

Thanks
Minfei

> 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 <yanjiang.jin@windriver.com>
> >>---
> >>  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;
> 
> 
> _______________________________________________
> kexec mailing list
> kexec@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/kexec
