linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] vmcore: replace Elf64_Ehdr/Elf32_Ehdr with elfhdr
@ 2015-09-16  2:58 yanjiang.jin
  2015-09-16  2:58 ` yanjiang.jin
  0 siblings, 1 reply; 7+ messages in thread
From: yanjiang.jin @ 2015-09-16  2:58 UTC (permalink / raw)
  To: akpm; +Cc: chaowang, yanjiang.jin, linux-kernel, jinyanjiang

From: Yanjiang Jin <yanjiang.jin@windriver.com>

Already verified this patch on a MIPS64 cavium octeon board: CN78XX.

This patch is to eliminate the compile warning only, has no side effect in run-time.

Yanjiang Jin (1):
  vmcore: replace Elf64_Ehdr/Elf32_Ehdr with elfhdr

 fs/proc/vmcore.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

-- 
1.9.1


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH] vmcore: replace Elf64_Ehdr/Elf32_Ehdr with elfhdr
  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 10:39   ` Minfei Huang
  0 siblings, 2 replies; 7+ messages in thread
From: yanjiang.jin @ 2015-09-16  2:58 UTC (permalink / raw)
  To: akpm; +Cc: chaowang, yanjiang.jin, linux-kernel, jinyanjiang

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);     \
                       ^
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;
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH] vmcore: replace Elf64_Ehdr/Elf32_Ehdr with elfhdr
  2015-09-16  2:58 ` yanjiang.jin
@ 2015-09-16  9:37   ` Dave Young
  2015-09-16 10:39   ` Minfei Huang
  1 sibling, 0 replies; 7+ messages in thread
From: Dave Young @ 2015-09-16  9:37 UTC (permalink / raw)
  To: yanjiang.jin; +Cc: akpm, chaowang, linux-kernel, jinyanjiang, kexec

Cc kexec list.

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);     \
>                        ^
> 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;
> -- 
> 1.9.1
> 
> 

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] vmcore: replace Elf64_Ehdr/Elf32_Ehdr with elfhdr
  2015-09-16  2:58 ` yanjiang.jin
  2015-09-16  9:37   ` Dave Young
@ 2015-09-16 10:39   ` Minfei Huang
  2015-09-16 10:44     ` Minfei Huang
  2015-09-17  9:32     ` yjin
  1 sibling, 2 replies; 7+ messages in thread
From: Minfei Huang @ 2015-09-16 10:39 UTC (permalink / raw)
  To: yanjiang.jin; +Cc: akpm, chaowang, linux-kernel, jinyanjiang

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

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;

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] vmcore: replace Elf64_Ehdr/Elf32_Ehdr with elfhdr
  2015-09-16 10:39   ` Minfei Huang
@ 2015-09-16 10:44     ` Minfei Huang
  2015-09-17  9:32     ` yjin
  1 sibling, 0 replies; 7+ messages in thread
From: Minfei Huang @ 2015-09-16 10:44 UTC (permalink / raw)
  To: yanjiang.jin; +Cc: akpm, kexec, linux-kernel, jinyanjiang

Ccing kexec maillist.

On 09/16/15 at 06:39pm, 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);
> 
> 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;

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] vmcore: replace Elf64_Ehdr/Elf32_Ehdr with elfhdr
  2015-09-16 10:39   ` Minfei Huang
  2015-09-16 10:44     ` Minfei Huang
@ 2015-09-17  9:32     ` yjin
  2015-09-18  5:49       ` Minfei Huang
  1 sibling, 1 reply; 7+ messages in thread
From: yjin @ 2015-09-17  9:32 UTC (permalink / raw)
  To: Minfei Huang; +Cc: akpm, chaowang, linux-kernel, jinyanjiang, kexec


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;


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] vmcore: replace Elf64_Ehdr/Elf32_Ehdr with elfhdr
  2015-09-17  9:32     ` yjin
@ 2015-09-18  5:49       ` Minfei Huang
  0 siblings, 0 replies; 7+ messages in thread
From: Minfei Huang @ 2015-09-18  5:49 UTC (permalink / raw)
  To: yjin; +Cc: kexec, akpm, jinyanjiang, linux-kernel, chaowang

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2015-09-18  5:48 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 10:39   ` Minfei Huang
2015-09-16 10:44     ` Minfei Huang
2015-09-17  9:32     ` yjin
2015-09-18  5:49       ` Minfei Huang

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 NNTP newsgroup(s).