[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v5 11/48] ivshmem: limit maximum number of peers to
From: |
marcandre . lureau |
Subject: |
[Qemu-devel] [PATCH v5 11/48] ivshmem: limit maximum number of peers to G_MAXUINT16 |
Date: |
Fri, 2 Oct 2015 21:09:14 +0200 |
From: Marc-André Lureau <address@hidden>
Limit the maximum number of peers to MAXUINT16. This is more realistic
and better matches the limit of the doorbell register.
Signed-off-by: Marc-André Lureau <address@hidden>
Reviewed-by: Claudio Fontana <address@hidden>
---
hw/misc/ivshmem.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/hw/misc/ivshmem.c b/hw/misc/ivshmem.c
index e7224b9..3787398 100644
--- a/hw/misc/ivshmem.c
+++ b/hw/misc/ivshmem.c
@@ -34,6 +34,7 @@
#define PCI_VENDOR_ID_IVSHMEM PCI_VENDOR_ID_REDHAT_QUMRANET
#define PCI_DEVICE_ID_IVSHMEM 0x1110
+#define IVSHMEM_MAX_PEERS G_MAXUINT16
#define IVSHMEM_IOEVENTFD 0
#define IVSHMEM_MSI 1
@@ -421,8 +422,8 @@ static int increase_dynamic_storage(IVShmemState *s, int
new_min_size)
int j, old_nb_alloc;
- /* check for integer overflow */
- if (new_min_size >= INT_MAX / sizeof(Peer) - 1 || new_min_size <= 0) {
+ /* limit number of max peers */
+ if (new_min_size <= 0 || new_min_size > IVSHMEM_MAX_PEERS) {
return -1;
}
--
2.4.3
- [Qemu-devel] [PATCH v5 00/48] ivshmem improvements, marcandre . lureau, 2015/10/08
- [Qemu-devel] [PATCH v5 02/48] msix: add VMSTATE_MSIX_TEST, marcandre . lureau, 2015/10/08
- [Qemu-devel] [PATCH v5 22/48] ivshmem: use common is_power_of_2(), marcandre . lureau, 2015/10/08
- [Qemu-devel] [PATCH v5 11/48] ivshmem: limit maximum number of peers to G_MAXUINT16,
marcandre . lureau <=
- [Qemu-devel] [PATCH v5 23/48] ivshmem: migrate with VMStateDescription, marcandre . lureau, 2015/10/08
- [Qemu-devel] [PATCH v5 17/48] ivshmem: improve debug messages, marcandre . lureau, 2015/10/08
- [Qemu-devel] [PATCH v5 26/48] ivshmem: add device description, marcandre . lureau, 2015/10/08
- [Qemu-devel] [PATCH v5 34/48] ivshmem-server: fix hugetlbfs support, marcandre . lureau, 2015/10/08
- [Qemu-devel] [PATCH v5 24/48] ivshmem: shmfd can be 0, marcandre . lureau, 2015/10/08
- [Qemu-devel] [PATCH v5 29/48] ivshmem: error on too many eventfd received, marcandre . lureau, 2015/10/08
- [Qemu-devel] [PATCH v5 33/48] ivshmem-server: use a uint16 for client ID, marcandre . lureau, 2015/10/08
- [Qemu-devel] [PATCH v5 31/48] contrib: add ivshmem client and server, marcandre . lureau, 2015/10/08