From: <yanjiang.jin@windriver.com>
To: <akpm@linux-foundation.org>, <mhuang@redhat.com>
Cc: <kexec@lists.infradead.org>, <chaowang@redhat.com>,
<yanjiang.jin@windriver.com>, <linux-kernel@vger.kernel.org>,
<jinyanjiang@gmail.com>
Subject: [PATCH] mips: vmcore: forced convert 'hdr' in elf_check_arch()
Date: Fri, 18 Sep 2015 15:42:51 +0800 [thread overview]
Message-ID: <1442562171-21307-2-git-send-email-yanjiang.jin@windriver.com> (raw)
In-Reply-To: <1442562171-21307-1-git-send-email-yanjiang.jin@windriver.com>
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
next prev parent reply other threads:[~2015-09-18 7:43 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-18 7:42 [V2 PATCH] " yanjiang.jin
2015-09-18 7:42 ` yanjiang.jin [this message]
2015-09-21 2:16 ` [PATCH] " yjin
2015-09-21 2:23 ` yjin
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=1442562171-21307-2-git-send-email-yanjiang.jin@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®