All of lore.kernel.org
 help / color / mirror / Atom feed
From: yjin <yanjiang.jin@windriver.com>
To: Minfei Huang <mhuang@redhat.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
Date: Thu, 17 Sep 2015 17:32:45 +0800	[thread overview]
Message-ID: <55FA88BD.3050303@windriver.com> (raw)
In-Reply-To: <20150916103917.GA32189@dhcp-128-25.nay.redhat.com>


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:-)
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

WARNING: multiple messages have this Message-ID (diff)
From: yjin <yanjiang.jin@windriver.com>
To: Minfei Huang <mhuang@redhat.com>
Cc: <akpm@linux-foundation.org>, <chaowang@redhat.com>,
	<linux-kernel@vger.kernel.org>, <jinyanjiang@gmail.com>,
	<kexec@lists.infradead.org>
Subject: Re: [PATCH] vmcore: replace Elf64_Ehdr/Elf32_Ehdr with elfhdr
Date: Thu, 17 Sep 2015 17:32:45 +0800	[thread overview]
Message-ID: <55FA88BD.3050303@windriver.com> (raw)
In-Reply-To: <20150916103917.GA32189@dhcp-128-25.nay.redhat.com>


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:-)
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;


  parent reply	other threads:[~2015-09-17  9:33 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-16  2:58 [PATCH] vmcore: replace Elf64_Ehdr/Elf32_Ehdr with elfhdr yanjiang.jin
2015-09-16  2:58 ` yanjiang.jin
2015-09-16  9:37   ` Dave Young
2015-09-16  9:37     ` Dave Young
2015-09-16 10:39   ` Minfei Huang
2015-09-16 10:44     ` Minfei Huang
2015-09-16 10:44       ` Minfei Huang
2015-09-17  9:32     ` yjin [this message]
2015-09-17  9:32       ` yjin
2015-09-18  5:49       ` Minfei Huang
2015-09-18  5:49         ` Minfei Huang

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=55FA88BD.3050303@windriver.com \
    --to=yanjiang.jin@windriver.com \
    --cc=akpm@linux-foundation.org \
    --cc=chaowang@redhat.com \
    --cc=jinyanjiang@gmail.com \
    --cc=kexec@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mhuang@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.