]> git.ipfire.org Git - thirdparty/elfutils.git/commitdiff
Initialize reglocs for VMCOREINFO
authorIlya Leoshkevich <iii@linux.ibm.com>
Mon, 6 Feb 2023 22:25:08 +0000 (23:25 +0100)
committerMark Wielaard <mark@klomp.org>
Wed, 8 Feb 2023 17:22:56 +0000 (18:22 +0100)
MSan complains:

    Uninitialized value was created by an allocation of 'reglocs' in the stack frame
       #0 0x562d35c686f0 in handle_core_note elfutils/src/readelf.c:12674:3
       #const Ebl_Register_Location *reglocs;
    ==1006199==WARNING: MemorySanitizer: use-of-uninitialized-value
       #0 0x562d35c68a2a in handle_core_note elfutils/src/readelf.c:12692:11
       #colno = handle_core_registers (ebl, ebl->elf, desc + regs_offset,
       #                               reglocs, nregloc);

Strictly speaking, this is not a problem, because nregloc == 0, but for
other note types we initialize it anyway, so do it here as well.

Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
backends/linux-core-note.c

index 9faae4c3594b66cf2c9e0659e13678ae09dd23fd..238ec16d4eeb19461cc66cfee52b83e7cf769a88 100644 (file)
@@ -239,6 +239,7 @@ EBLHOOK(core_note) (const GElf_Nhdr *nhdr, const char *name,
        return 0;
       *regs_offset = 0;
       *nregloc = 0;
+      *reglocs = NULL;
       *nitems = 1;
       *items = vmcoreinfo_items;
       return 1;