summaryrefslogtreecommitdiff
path: root/include/linux
diff options
context:
space:
mode:
authorJacob Keller <jacob.e.keller@intel.com>2023-02-28 00:41:27 +0300
committerMichael S. Tsirkin <mst@redhat.com>2023-04-21 10:02:29 +0300
commite4be66e5f36b8cd2a052ba9e2ba063e6c37f5453 (patch)
tree5df0bbda6cdfb1e93268b9f402ba613eede10db5 /include/linux
parentc384c2401eed99a2e1f84191e573f15b898babe6 (diff)
downloadlinux-e4be66e5f36b8cd2a052ba9e2ba063e6c37f5453.tar.xz
vhost: use struct_size and size_add to compute flex array sizes
The vhost_get_avail_size and vhost_get_used_size functions compute the size of structures with flexible array members with an additional 2 bytes if the VIRTIO_RING_F_EVENT_IDX feature flag is set. Convert these functions to use struct_size() and size_add() instead of coding the calculation by hand. This ensures that the calculations will saturate at SIZE_MAX rather than overflowing. Signed-off-by: Jacob Keller <jacob.e.keller@intel.com> Cc: "Michael S. Tsirkin" <mst@redhat.com> Cc: Jason Wang <jasowang@redhat.com> Cc: virtualization@lists.linux-foundation.org Cc: kvm@vger.kernel.org Message-Id: <20230227214127.3678392-1-jacob.e.keller@intel.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'include/linux')
0 files changed, 0 insertions, 0 deletions