[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 29/30] pc-dimm: fix error messages if no slots were d
From: |
Paolo Bonzini |
Subject: |
[Qemu-devel] [PULL 29/30] pc-dimm: fix error messages if no slots were defined |
Date: |
Wed, 9 May 2018 00:14:46 +0200 |
From: David Hildenbrand <address@hidden>
If no slots were defined we try to allocate an empty bitmap, which
fails.
Signed-off-by: David Hildenbrand <address@hidden>
Reviewed-by: Marcel Apfelbaum <address@hidden>
Reviewed-by: Thomas Huth <address@hidden>
Message-Id: <address@hidden>
Signed-off-by: Paolo Bonzini <address@hidden>
---
hw/mem/pc-dimm.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/hw/mem/pc-dimm.c b/hw/mem/pc-dimm.c
index 0119c68..12da89d 100644
--- a/hw/mem/pc-dimm.c
+++ b/hw/mem/pc-dimm.c
@@ -118,9 +118,16 @@ static int pc_dimm_slot2bitmap(Object *obj, void *opaque)
int pc_dimm_get_free_slot(const int *hint, int max_slots, Error **errp)
{
- unsigned long *bitmap = bitmap_new(max_slots);
+ unsigned long *bitmap;
int slot = 0;
+ if (max_slots <= 0) {
+ error_setg(errp, "no slots where allocated, please specify "
+ "the 'slots' option");
+ return slot;
+ }
+
+ bitmap = bitmap_new(max_slots);
object_child_foreach(qdev_get_machine(), pc_dimm_slot2bitmap, bitmap);
/* check if requested slot is not occupied */
--
1.8.3.1
- [Qemu-devel] [PULL 16/30] target/i386: sev: fix memory leaks, (continued)
- [Qemu-devel] [PULL 16/30] target/i386: sev: fix memory leaks, Paolo Bonzini, 2018/05/08
- [Qemu-devel] [PULL 15/30] opts: don't silently truncate long option values, Paolo Bonzini, 2018/05/08
- [Qemu-devel] [PULL 21/30] qemu-options: Remove deprecated -no-kvm-irqchip, Paolo Bonzini, 2018/05/08
- [Qemu-devel] [PULL 25/30] configure: Really use local libfdt if the system one is too old, Paolo Bonzini, 2018/05/08
- [Qemu-devel] [PULL 22/30] qemu-doc: provide details of supported build platforms, Paolo Bonzini, 2018/05/08
- [Qemu-devel] [PULL 23/30] glib: bump min required glib library version to 2.42, Paolo Bonzini, 2018/05/08
- [Qemu-devel] [PULL 27/30] shippable: Remove Debian 8 libfdt kludge, Paolo Bonzini, 2018/05/08
- [Qemu-devel] [PULL 26/30] configure: Display if libfdt is from system or git, Paolo Bonzini, 2018/05/08
- [Qemu-devel] [PULL 24/30] i386/kvm: add support for Hyper-V reenlightenment MSRs, Paolo Bonzini, 2018/05/08
- [Qemu-devel] [PULL 28/30] build: Silence dtc directory creation, Paolo Bonzini, 2018/05/08
- [Qemu-devel] [PULL 29/30] pc-dimm: fix error messages if no slots were defined,
Paolo Bonzini <=
- [Qemu-devel] [PULL 30/30] rename included C files to foo.inc.c, remove osdep.h, Paolo Bonzini, 2018/05/08
- Re: [Qemu-devel] [PULL 00/30] Misc patches for 2018-05-09, Peter Maydell, 2018/05/11