Kaynağa Gözat

dump: fix note_name_equal()

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>
Marc-André Lureau 7 yıl önce
ebeveyn
işleme
c983ca8457
1 değiştirilmiş dosya ile 1 ekleme ve 6 silme
  1. 1 6
      dump.c

+ 1 - 6
dump.c

@@ -788,12 +788,7 @@ static bool note_name_equal(DumpState *s,
     get_note_sizes(s, note, &head_size, &name_size, NULL);
     get_note_sizes(s, note, &head_size, &name_size, NULL);
     head_size = ROUND_UP(head_size, 4);
     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 */
 /* write common header, sub header and elf note to vmcore */