]> git.proxmox.com Git - mirror_qemu.git/commitdiff
dump: fix note_name_equal()
authorMarc-André Lureau <marcandre.lureau@redhat.com>
Tue, 12 Dec 2017 14:53:59 +0000 (15:53 +0100)
committerMarc-André Lureau <marcandre.lureau@redhat.com>
Tue, 2 Jan 2018 13:49:54 +0000 (14:49 +0100)
Use the function argument "name" instead of hardcoded
"VMCOREINFO". All callers use "VMCOREINFO" as argument, so this isn't
an exposed bug, thankfully.

Simplify a little bit the code while touching this.

Suggested-by: Andrew Jones <drjones@redhat.com>
Reported-by: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
dump.c

diff --git a/dump.c b/dump.c
index d4a8c942eb8f07b67b38c0a52b1acf77e26c8c3a..e9dfed060a5cc477d146f2324747e1188cf08133 100644 (file)
--- a/dump.c
+++ b/dump.c
@@ -788,12 +788,7 @@ static bool note_name_equal(DumpState *s,
     get_note_sizes(s, note, &head_size, &name_size, NULL);
     head_size = ROUND_UP(head_size, 4);
 
-    if (name_size != len ||
-        memcmp(note + head_size, "VMCOREINFO", len)) {
-        return false;
-    }
-
-    return true;
+    return name_size == len && memcmp(note + head_size, name, len) == 0;
 }
 
 /* write common header, sub header and elf note to vmcore */