* [PATCH] dump: Silence compiler warning in dump code when compiling with -Wshadow
@ 2023-10-04 13:13 Thomas Huth
2023-10-04 13:59 ` Philippe Mathieu-Daudé
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Thomas Huth @ 2023-10-04 13:13 UTC (permalink / raw)
To: qemu-devel, Marc-André Lureau; +Cc: Markus Armbruster, qemu-trivial
Rename a variable to make this code compilable with -Wshadow.
Signed-off-by: Thomas Huth <thuth@redhat.com>
---
dump/dump.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/dump/dump.c b/dump/dump.c
index d4ef713cd0..d3578ddc62 100644
--- a/dump/dump.c
+++ b/dump/dump.c
@@ -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);
--
2.41.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] dump: Silence compiler warning in dump code when compiling with -Wshadow
2023-10-04 13:13 [PATCH] dump: Silence compiler warning in dump code when compiling with -Wshadow Thomas Huth
@ 2023-10-04 13:59 ` Philippe Mathieu-Daudé
2023-10-06 6:38 ` Michael Tokarev
2023-10-06 10:46 ` Michael Tokarev
2 siblings, 0 replies; 4+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-10-04 13:59 UTC (permalink / raw)
To: Thomas Huth, qemu-devel, Marc-André Lureau
Cc: Markus Armbruster, qemu-trivial
On 4/10/23 15:13, Thomas Huth wrote:
> Rename a variable to make this code compilable with -Wshadow.
>
> Signed-off-by: Thomas Huth <thuth@redhat.com>
> ---
> dump/dump.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] dump: Silence compiler warning in dump code when compiling with -Wshadow
2023-10-04 13:13 [PATCH] dump: Silence compiler warning in dump code when compiling with -Wshadow Thomas Huth
2023-10-04 13:59 ` Philippe Mathieu-Daudé
@ 2023-10-06 6:38 ` Michael Tokarev
2023-10-06 10:46 ` Michael Tokarev
2 siblings, 0 replies; 4+ messages in thread
From: Michael Tokarev @ 2023-10-06 6:38 UTC (permalink / raw)
To: Thomas Huth, qemu-devel, Marc-André Lureau
Cc: Markus Armbruster, qemu-trivial
Applied to my trivial-patches tree, thanks!
/mjt
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] dump: Silence compiler warning in dump code when compiling with -Wshadow
2023-10-04 13:13 [PATCH] dump: Silence compiler warning in dump code when compiling with -Wshadow Thomas Huth
2023-10-04 13:59 ` Philippe Mathieu-Daudé
2023-10-06 6:38 ` Michael Tokarev
@ 2023-10-06 10:46 ` Michael Tokarev
2 siblings, 0 replies; 4+ messages in thread
From: Michael Tokarev @ 2023-10-06 10:46 UTC (permalink / raw)
To: Thomas Huth, qemu-devel, Marc-André Lureau
Cc: Markus Armbruster, qemu-trivial
04.10.2023 16:13, Thomas Huth:
> Rename a variable to make this code compilable with -Wshadow.
>
> Signed-off-by: Thomas Huth <thuth@redhat.com>
Reviewed-By: Michael Tokarev <mjt@tls.msk.ru>
> dump/dump.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/dump/dump.c b/dump/dump.c
> index d4ef713cd0..d3578ddc62 100644
> --- a/dump/dump.c
> +++ b/dump/dump.c
> @@ -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);
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2023-10-06 10:47 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-10-04 13:13 [PATCH] dump: Silence compiler warning in dump code when compiling with -Wshadow Thomas Huth
2023-10-04 13:59 ` Philippe Mathieu-Daudé
2023-10-06 6:38 ` Michael Tokarev
2023-10-06 10:46 ` Michael Tokarev
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).