On Thu, Jun 04, 2020 at 12:39:34PM +0200, Eugenio Perez Martin wrote: > > +static int vhost_vdpa_set_config(struct vhost_dev *dev, const uint8_t > > *data, > > + uint32_t offset, uint32_t size, > > + uint32_t flags) > > +{ > > + struct vhost_vdpa_config config; > > + int ret; > > + if ((size > VHOST_VDPA_MAX_CONFIG_SIZE) || (data == NULL)) { > > VHOST_VDPA_MAX_CONFIG_SIZE is currently undefined. > > If we want to maintain this as a stack allocation (as proposed in > https://www.mail-archive.com/qemu-devel@nongnu.org/msg701744.html) I > think that the best option is to decide which is the maximum value buf > can hold, and set it in vhost_vdpa_config.buf declaration.
That depends on device features. qemu has logic to figure out config size based on that and set config_size accordingly. Why not reuse it? Sending more should be ok and extra data just ignored. -- MST