summaryrefslogtreecommitdiff
path: root/elf_info.c
diff options
context:
space:
mode:
authorHATAYAMA Daisuke <d.hatayama@jp.fujitsu.com>2013-03-04 13:18:35 +0900
committerAtsushi Kumagai <kumagai-atsushi@mxc.nes.nec.co.jp>2013-03-13 10:12:44 +0900
commita5badad1d92fe223822f3e2087744f7b46f98dbc (patch)
treeb31e447450b4ea34b544188b4b94f0a39d815059 /elf_info.c
parent279e5c0f776ad7ac58d8cd920ee23144f8fc12f1 (diff)
[PATCH 2/3] elf: swap checking order of VMCOREINFO and VMCOREINFO_XEN.
Currently, get_pt_note_info() checks ELF note in "VMCOREINFO_XEN" name first and then in "VMCOREINFO" name to avoid the case where "VMCOREINFO_XEN" is wrongly interpreted as "VMCOREINFO". However, characters checked by strncmp() includes null character. The case concerned about there can never happen. This patch swaps checking order of VMCOREINFO and VMCOREINFO_XEN, which is natural in the sense that the direction from general one to specific one is natural. Signed-off-by: HATAYAMA Daisuke <d.hatayama@jp.fujitsu.com>
Diffstat (limited to 'elf_info.c')
-rw-r--r--elf_info.c13
1 files changed, 4 insertions, 9 deletions
diff --git a/elf_info.c b/elf_info.c
index b0e45b5..f9c554d 100644
--- a/elf_info.c
+++ b/elf_info.c
@@ -323,22 +323,17 @@ get_pt_note_info(void)
offset_desc = offset + offset_note_desc(note);
size_desc = note_descsz(note);
+ if (!strncmp(VMCOREINFO_NOTE_NAME, buf,
+ VMCOREINFO_NOTE_NAME_BYTES)) {
+ set_vmcoreinfo(offset_desc, size_desc);
/*
* Check whether /proc/vmcore contains vmcoreinfo,
* and get both the offset and the size.
- *
- * NOTE: The owner name of xen should be checked at first,
- * because its name is "VMCOREINFO_XEN" and the one
- * of linux is "VMCOREINFO".
*/
- if (!strncmp(VMCOREINFO_XEN_NOTE_NAME, buf,
+ } else if (!strncmp(VMCOREINFO_XEN_NOTE_NAME, buf,
VMCOREINFO_XEN_NOTE_NAME_BYTES)) {
offset_vmcoreinfo_xen = offset_desc;
size_vmcoreinfo_xen = size_desc;
- } else if (!strncmp(VMCOREINFO_NOTE_NAME, buf,
- VMCOREINFO_NOTE_NAME_BYTES)) {
- set_vmcoreinfo(offset_desc, size_desc);
-
/*
* Check whether /proc/vmcore contains xen's note.
*/