Skip to content

Commit

Permalink
dump: Silence compiler warning in dump code when compiling with -Wshadow
Browse files Browse the repository at this point in the history
Rename a variable to make this code compilable with -Wshadow.

Signed-off-by: Thomas Huth <thuth@redhat.com>
Message-ID: <20231004131338.215081-1-thuth@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-By: Michael Tokarev <mjt@tls.msk.ru>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
  • Loading branch information
huth authored and Markus Armbruster committed Oct 6, 2023
1 parent da31828 commit 71efffb
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions dump/dump.c
Original file line number Diff line number Diff line change
Expand Up @@ -1872,20 +1872,20 @@ static void dump_init(DumpState *s, int fd, bool has_format,
if (vmci) {
uint64_t addr, note_head_size, name_size, desc_size;
uint32_t size;
uint16_t format;
uint16_t guest_format;

note_head_size = dump_is_64bit(s) ?
sizeof(Elf64_Nhdr) : sizeof(Elf32_Nhdr);

format = le16_to_cpu(vmci->vmcoreinfo.guest_format);
guest_format = le16_to_cpu(vmci->vmcoreinfo.guest_format);
size = le32_to_cpu(vmci->vmcoreinfo.size);
addr = le64_to_cpu(vmci->vmcoreinfo.paddr);
if (!vmci->has_vmcoreinfo) {
warn_report("guest note is not present");
} else if (size < note_head_size || size > MAX_GUEST_NOTE_SIZE) {
warn_report("guest note size is invalid: %" PRIu32, size);
} else if (format != FW_CFG_VMCOREINFO_FORMAT_ELF) {
warn_report("guest note format is unsupported: %" PRIu16, format);
} else if (guest_format != FW_CFG_VMCOREINFO_FORMAT_ELF) {
warn_report("guest note format is unsupported: %" PRIu16, guest_format);
} else {
s->guest_note = g_malloc(size + 1); /* +1 for adding \0 */
cpu_physical_memory_read(addr, s->guest_note, size);
Expand Down

0 comments on commit 71efffb

Please sign in to comment.