[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL v3 12/51] ivshmem: limit maximum number of peers to G
From: |
marcandre . lureau |
Subject: |
[Qemu-devel] [PULL v3 12/51] ivshmem: limit maximum number of peers to G_MAXUINT16 |
Date: |
Tue, 13 Oct 2015 16:25:39 +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] [PULL v3 33/51] contrib: add ivshmem client and server, (continued)
- [Qemu-devel] [PULL v3 33/51] contrib: add ivshmem client and server, marcandre . lureau, 2015/10/13
- [Qemu-devel] [PULL v3 43/51] tests: add ivshmem qtest, marcandre . lureau, 2015/10/13
- [Qemu-devel] [PULL v3 44/51] ivshmem: do not keep shm_fd open, marcandre . lureau, 2015/10/13
- [Qemu-devel] [PULL v3 36/51] ivshmem-server: fix hugetlbfs support, marcandre . lureau, 2015/10/13
- [Qemu-devel] [PULL v3 37/51] docs: update ivshmem device spec, marcandre . lureau, 2015/10/13
- [Qemu-devel] [PULL v3 42/51] glib-compat: add 2.38/2.40/2.46 asserts, marcandre . lureau, 2015/10/13
- [Qemu-devel] [PULL v3 48/51] ivshmem: rename MSI eventfd_table, marcandre . lureau, 2015/10/13
- [Qemu-devel] [PULL v3 50/51] ivshmem: use little-endian int64_t for the protocol, marcandre . lureau, 2015/10/13
- [Qemu-devel] [PULL v3 47/51] ivshmem: remove EventfdEntry.vector, marcandre . lureau, 2015/10/13
- [Qemu-devel] [PULL v3 51/51] doc: document ivshmem & hugepages, marcandre . lureau, 2015/10/13
- [Qemu-devel] [PULL v3 12/51] ivshmem: limit maximum number of peers to G_MAXUINT16,
marcandre . lureau <=
- [Qemu-devel] [PULL v3 14/51] ivshmem: allocate eventfds in resize_peers(), marcandre . lureau, 2015/10/15
- [Qemu-devel] [PULL v3 27/51] ivshmem: add device description, marcandre . lureau, 2015/10/15
- [Qemu-devel] [PULL v3 13/51] ivshmem: simplify around increase_dynamic_storage(), marcandre . lureau, 2015/10/15
- [Qemu-devel] [PULL v3 16/51] ivshmem: initialize max_peer to -1, marcandre . lureau, 2015/10/15
- [Qemu-devel] [PULL v3 32/51] util: const event_notifier_get_fd() argument, marcandre . lureau, 2015/10/15
- [Qemu-devel] [PULL v3 40/51] msix: implement pba write (but read-only), marcandre . lureau, 2015/10/15
- [Qemu-devel] [PULL v3 39/51] contrib: remove unnecessary strdup(), marcandre . lureau, 2015/10/15
- [Qemu-devel] [PULL v3 38/51] ivshmem: add check on protocol version in QEMU, marcandre . lureau, 2015/10/15
- [Qemu-devel] [PULL v3 41/51] qtest: add qtest_add_abrt_handler(), marcandre . lureau, 2015/10/15
- [Qemu-devel] [PULL v3 46/51] ivshmem: add hostmem backend, marcandre . lureau, 2015/10/15