vdpa/ifc: fix vhost message size check

For vhost message VHOST_USER_GET_CONFIG, we do not check
payload size in vhost lib, we check payload size in driver
specific ops.
For ifc vdpa driver, we just need to make sure payload size
is not smaller than sizeof(struct virtio_blk_config).

Fixes: 856d03bcdc ("vdpa/ifc: add block operations")

Signed-off-by: Andy Pei <andy.pei@intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
This commit is contained in:
Andy Pei 2022-06-21 21:46:31 +08:00 committed by Maxime Coquelin
parent 9851c4e339
commit 98c6096187

View File

@ -1400,7 +1400,7 @@ ifcvf_blk_get_config(int vid, uint8_t *config, uint32_t size)
uint64_t capacity = 0;
uint8_t *byte;
if (size != sizeof(struct virtio_blk_config)) {
if (size < sizeof(struct virtio_blk_config)) {
DRV_LOG(ERR, "Invalid len: %u, required: %u",
size, (uint32_t)sizeof(struct virtio_blk_config));
return -1;