[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v3 11/46] ivshmem: limit maximum number of peers
From: |
Claudio Fontana |
Subject: |
Re: [Qemu-devel] [PATCH v3 11/46] ivshmem: limit maximum number of peers to G_MAXUINT16 |
Date: |
Tue, 22 Sep 2015 16:09:12 +0200 |
User-agent: |
Mozilla/5.0 (Windows NT 6.1; rv:38.0) Gecko/20100101 Thunderbird/38.2.0 |
On 15.09.2015 18:07, address@hidden wrote:
> 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>
> ---
> 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 7ba93c0..cd2c4bc 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;
> }
>
>
Reviewed-by: Claudio Fontana <address@hidden>
--
Claudio Fontana
Server Virtualization Architect
Huawei Technologies Duesseldorf GmbH
Riesstraße 25 - 80992 München
- Re: [Qemu-devel] [PATCH v3 06/46] ivshmem: remove unnecessary dup(), (continued)
- [Qemu-devel] [PATCH v3 08/46] ivshmem: remove useless doorbell field, marcandre . lureau, 2015/09/15
- [Qemu-devel] [PATCH v3 09/46] ivshmem: more qdev conversion, marcandre . lureau, 2015/09/15
- [Qemu-devel] [PATCH v3 10/46] ivshmem: remove last exit(1), marcandre . lureau, 2015/09/15
- [Qemu-devel] [PATCH v3 11/46] ivshmem: limit maximum number of peers to G_MAXUINT16, marcandre . lureau, 2015/09/15
- Re: [Qemu-devel] [PATCH v3 11/46] ivshmem: limit maximum number of peers to G_MAXUINT16,
Claudio Fontana <=
- [Qemu-devel] [PATCH v3 12/46] ivshmem: simplify around increase_dynamic_storage(), marcandre . lureau, 2015/09/15
- [Qemu-devel] [PATCH v3 13/46] ivshmem: allocate eventfds in resize_peers(), marcandre . lureau, 2015/09/15
- [Qemu-devel] [PATCH v3 14/46] ivshmem: remove useless ivshmem_update_irq() val argument, marcandre . lureau, 2015/09/15
- [Qemu-devel] [PATCH v3 15/46] ivshmem: initialize max_peer to -1, marcandre . lureau, 2015/09/15
- [Qemu-devel] [PATCH v3 16/46] ivshmem: remove max_peer field, marcandre . lureau, 2015/09/15