[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 04/12] libvhost-user.c: add assertion to vu_message_read_default
From: |
Vladimir Sementsov-Ogievskiy |
Subject: |
[PATCH 04/12] libvhost-user.c: add assertion to vu_message_read_default |
Date: |
Mon, 25 Sep 2023 22:40:32 +0300 |
Explain Coverity that we are not going to overflow vmsg->fds.
Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
---
subprojects/libvhost-user/libvhost-user.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/subprojects/libvhost-user/libvhost-user.c
b/subprojects/libvhost-user/libvhost-user.c
index 0469a50101..49b57c7ef4 100644
--- a/subprojects/libvhost-user/libvhost-user.c
+++ b/subprojects/libvhost-user/libvhost-user.c
@@ -322,6 +322,7 @@ vu_message_read_default(VuDev *dev, int conn_fd,
VhostUserMsg *vmsg)
if (cmsg->cmsg_level == SOL_SOCKET && cmsg->cmsg_type == SCM_RIGHTS) {
fd_size = cmsg->cmsg_len - CMSG_LEN(0);
vmsg->fd_num = fd_size / sizeof(int);
+ assert(fd_size < VHOST_MEMORY_BASELINE_NREGIONS);
memcpy(vmsg->fds, CMSG_DATA(cmsg), fd_size);
break;
}
--
2.34.1
- [PATCH 00/12] coverity fixes, Vladimir Sementsov-Ogievskiy, 2023/09/25
- [PATCH 04/12] libvhost-user.c: add assertion to vu_message_read_default,
Vladimir Sementsov-Ogievskiy <=
- [PATCH 02/12] hw/i386/intel_iommu: vtd_slpte_nonzero_rsvd(): reduce magic numbers, Vladimir Sementsov-Ogievskiy, 2023/09/25
- Re: [PATCH 02/12] hw/i386/intel_iommu: vtd_slpte_nonzero_rsvd(): reduce magic numbers, Peter Maydell, 2023/09/26
- Re: [PATCH 02/12] hw/i386/intel_iommu: vtd_slpte_nonzero_rsvd(): reduce magic numbers, Vladimir Sementsov-Ogievskiy, 2023/09/26
- Re: [PATCH 02/12] hw/i386/intel_iommu: vtd_slpte_nonzero_rsvd(): reduce magic numbers, Vladimir Sementsov-Ogievskiy, 2023/09/26
- Re: [PATCH 02/12] hw/i386/intel_iommu: vtd_slpte_nonzero_rsvd(): reduce magic numbers, Peter Maydell, 2023/09/26
- Re: [PATCH 02/12] hw/i386/intel_iommu: vtd_slpte_nonzero_rsvd(): reduce magic numbers, Vladimir Sementsov-Ogievskiy, 2023/09/26
[PATCH 01/12] hw/core/loader: load_at(): check size, Vladimir Sementsov-Ogievskiy, 2023/09/25