Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1227627 > unrolled thread

[V2 PATCH] mips: vmcore: forced convert 'hdr' in elf_check_arch()

Started by<yanjiang.jin@windriver.com>
First post2015-09-18 09:50 +0200
Last post2015-09-21 04:30 +0200
Articles 4 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [V2 PATCH] mips: vmcore: forced convert 'hdr' in elf_check_arch() <yanjiang.jin@windriver.com> - 2015-09-18 09:50 +0200
    [PATCH] mips: vmcore: forced convert 'hdr' in elf_check_arch() <yanjiang.jin@windriver.com> - 2015-09-18 09:50 +0200
      Re: [PATCH] mips: vmcore: forced convert 'hdr' in elf_check_arch() yjin <yanjiang.jin@windriver.com> - 2015-09-21 04:20 +0200
        Re: [PATCH] mips: vmcore: forced convert 'hdr' in elf_check_arch() yjin <yanjiang.jin@windriver.com> - 2015-09-21 04:30 +0200

#1227627 — [V2 PATCH] mips: vmcore: forced convert 'hdr' in elf_check_arch()

From<yanjiang.jin@windriver.com>
Date2015-09-18 09:50 +0200
Subject[V2 PATCH] mips: vmcore: forced convert 'hdr' in elf_check_arch()
Message-ID<q9YAG-4B2-27@gated-at.bofh.it>
From: Yanjiang Jin <yanjiang.jin@windriver.com>

V1->V2: According to Minfei's suggestion, coverting in the Macro rather
than in vmcore.c.

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):
  mips: vmcore: forced convert 'hdr' in elf_check_arch()

 arch/mips/include/asm/elf.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [next] | [standalone]


#1227629 — [PATCH] mips: vmcore: forced convert 'hdr' in elf_check_arch()

From<yanjiang.jin@windriver.com>
Date2015-09-18 09:50 +0200
Subject[PATCH] mips: vmcore: forced convert 'hdr' in elf_check_arch()
Message-ID<q9YAG-4B2-29@gated-at.bofh.it>
In reply to#1227627
From: Yanjiang Jin <yanjiang.jin@windriver.com>

elf_check_arch() will be called both in parse_crash_elf64_headers()
and parse_crash_elf32_headers(). But in these two functions, the type of
the parameter ehdr is different: Elf32_Ehdr and Elf64_Ehdr.

Function parse_crash_elf_headers() reads e_ident[EI_CLASS] then decides to
call parse_crash_elf64_headers() or parse_crash_elf32_headers().
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>
---
 arch/mips/include/asm/elf.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/mips/include/asm/elf.h b/arch/mips/include/asm/elf.h
index f19e890..ece490d 100644
--- a/arch/mips/include/asm/elf.h
+++ b/arch/mips/include/asm/elf.h
@@ -224,7 +224,7 @@ struct mips_elf_abiflags_v0 {
 #define elf_check_arch(hdr)						\
 ({									\
 	int __res = 1;							\
-	struct elfhdr *__h = (hdr);					\
+	struct elfhdr *__h = (struct elfhdr *)(hdr);			\
 									\
 	if (__h->e_machine != EM_MIPS)					\
 		__res = 0;						\
@@ -255,7 +255,7 @@ struct mips_elf_abiflags_v0 {
 #define elf_check_arch(hdr)						\
 ({									\
 	int __res = 1;							\
-	struct elfhdr *__h = (hdr);					\
+	struct elfhdr *__h = (struct elfhdr *)(hdr);			\
 									\
 	if (__h->e_machine != EM_MIPS)					\
 		__res = 0;						\
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1228995 — Re: [PATCH] mips: vmcore: forced convert 'hdr' in elf_check_arch()

Fromyjin <yanjiang.jin@windriver.com>
Date2015-09-21 04:20 +0200
SubjectRe: [PATCH] mips: vmcore: forced convert 'hdr' in elf_check_arch()
Message-ID<qaYRY-1qj-7@gated-at.bofh.it>
In reply to#1227629

[Multipart message — attachments visible in raw view] — view raw

The new version patch only modifies mips/elf.h, so add Ralf Baechle and 
cc linux-mips@linux-mips.org.
This is a V2 patch, attach the V1 patch for reference.

Thanks!
Yanjiang

On 2015年09月18日 15:42, yanjiang.jin@windriver.com wrote:
> From: Yanjiang Jin <yanjiang.jin@windriver.com>
>
> elf_check_arch() will be called both in parse_crash_elf64_headers()
> and parse_crash_elf32_headers(). But in these two functions, the type of
> the parameter ehdr is different: Elf32_Ehdr and Elf64_Ehdr.
>
> Function parse_crash_elf_headers() reads e_ident[EI_CLASS] then decides to
> call parse_crash_elf64_headers() or parse_crash_elf32_headers().
> 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>
> ---
>   arch/mips/include/asm/elf.h | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/arch/mips/include/asm/elf.h b/arch/mips/include/asm/elf.h
> index f19e890..ece490d 100644
> --- a/arch/mips/include/asm/elf.h
> +++ b/arch/mips/include/asm/elf.h
> @@ -224,7 +224,7 @@ struct mips_elf_abiflags_v0 {
>   #define elf_check_arch(hdr)						\
>   ({									\
>   	int __res = 1;							\
> -	struct elfhdr *__h = (hdr);					\
> +	struct elfhdr *__h = (struct elfhdr *)(hdr);			\
>   									\
>   	if (__h->e_machine != EM_MIPS)					\
>   		__res = 0;						\
> @@ -255,7 +255,7 @@ struct mips_elf_abiflags_v0 {
>   #define elf_check_arch(hdr)						\
>   ({									\
>   	int __res = 1;							\
> -	struct elfhdr *__h = (hdr);					\
> +	struct elfhdr *__h = (struct elfhdr *)(hdr);			\
>   									\
>   	if (__h->e_machine != EM_MIPS)					\
>   		__res = 0;						\

[toc] | [prev] | [next] | [standalone]


#1228997 — Re: [PATCH] mips: vmcore: forced convert 'hdr' in elf_check_arch()

Fromyjin <yanjiang.jin@windriver.com>
Date2015-09-21 04:30 +0200
SubjectRe: [PATCH] mips: vmcore: forced convert 'hdr' in elf_check_arch()
Message-ID<qaZ1E-1Bl-3@gated-at.bofh.it>
In reply to#1228995
It seems the last mail has been blocked, resend it.

On 2015年09月21日 10:16, yjin wrote:
> The new version patch only modifies mips/elf.h, so add Ralf Baechle 
> and cc linux-mips@linux-mips.org.
> This is a V2 patch, attach the V1 patch for reference.
>
> Thanks!
> Yanjiang
>
> On 2015年09月18日 15:42, yanjiang.jin@windriver.com wrote:
>> From: Yanjiang Jin <yanjiang.jin@windriver.com>
>>
>> elf_check_arch() will be called both in parse_crash_elf64_headers()
>> and parse_crash_elf32_headers(). But in these two functions, the type of
>> the parameter ehdr is different: Elf32_Ehdr and Elf64_Ehdr.
>>
>> Function parse_crash_elf_headers() reads e_ident[EI_CLASS] then 
>> decides to
>> call parse_crash_elf64_headers() or parse_crash_elf32_headers().
>> 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>
>> ---
>>   arch/mips/include/asm/elf.h | 4 ++--
>>   1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/arch/mips/include/asm/elf.h b/arch/mips/include/asm/elf.h
>> index f19e890..ece490d 100644
>> --- a/arch/mips/include/asm/elf.h
>> +++ b/arch/mips/include/asm/elf.h
>> @@ -224,7 +224,7 @@ struct mips_elf_abiflags_v0 {
>>   #define elf_check_arch(hdr)                        \
>>   ({                                    \
>>       int __res = 1;                            \
>> -    struct elfhdr *__h = (hdr);                    \
>> +    struct elfhdr *__h = (struct elfhdr *)(hdr);            \
>>                                       \
>>       if (__h->e_machine != EM_MIPS)                    \
>>           __res = 0;                        \
>> @@ -255,7 +255,7 @@ struct mips_elf_abiflags_v0 {
>>   #define elf_check_arch(hdr)                        \
>>   ({                                    \
>>       int __res = 1;                            \
>> -    struct elfhdr *__h = (hdr);                    \
>> +    struct elfhdr *__h = (struct elfhdr *)(hdr);            \
>>                                       \
>>       if (__h->e_machine != EM_MIPS)                    \
>>           __res = 0;                        \
>

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web