qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] hw/i386/pc: when adding reserved E820 entries do not allocate dynamic entries
@ 2022-02-10 13:28 Ani Sinha
  2022-02-10 16:10 ` Philippe Mathieu-Daudé via
  2022-02-23  9:04 ` Igor Mammedov
  0 siblings, 2 replies; 9+ messages in thread
From: Ani Sinha @ 2022-02-10 13:28 UTC (permalink / raw)
  To: qemu-devel, Paolo Bonzini, Richard Henderson, Eduardo Habkost,
	Michael S. Tsirkin, Marcel Apfelbaum
  Cc: Ani Sinha, kraxel

When adding E820_RESERVED entries we also accidentally allocate dynamic
entries. This is incorrect. We should simply return early with the count of
the number of reserved entries added.

fixes: 7d67110f2d9a6("pc: add etc/e820 fw_cfg file")
cc: kraxel@redhat.com
Signed-off-by: Ani Sinha <ani@anisinha.ca>
---
 hw/i386/e820_memory_layout.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/hw/i386/e820_memory_layout.c b/hw/i386/e820_memory_layout.c
index bcf9eaf837..afb08253a4 100644
--- a/hw/i386/e820_memory_layout.c
+++ b/hw/i386/e820_memory_layout.c
@@ -31,6 +31,8 @@ int e820_add_entry(uint64_t address, uint64_t length, uint32_t type)
         entry->type = cpu_to_le32(type);
 
         e820_reserve.count = cpu_to_le32(index);
+
+        return index;
     }
 
     /* new "etc/e820" file -- include ram too */
-- 
2.25.1



^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2022-02-28 10:30 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-02-10 13:28 [PATCH] hw/i386/pc: when adding reserved E820 entries do not allocate dynamic entries Ani Sinha
2022-02-10 16:10 ` Philippe Mathieu-Daudé via
2022-02-11 11:19   ` Ani Sinha
2022-02-23  9:04 ` Igor Mammedov
2022-02-23 12:00   ` Ani Sinha
2022-02-24  9:03     ` Igor Mammedov
2022-02-24 12:44       ` Ani Sinha
2022-02-24 13:21         ` Igor Mammedov
2022-02-28 10:28           ` Ani Sinha

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).