diff options
-rw-r--r-- | contrib/vhost-user-gpu/vhost-user-gpu.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/contrib/vhost-user-gpu/vhost-user-gpu.c b/contrib/vhost-user-gpu/vhost-user-gpu.c index a019d0a..f445ef2 100644 --- a/contrib/vhost-user-gpu/vhost-user-gpu.c +++ b/contrib/vhost-user-gpu/vhost-user-gpu.c @@ -1044,7 +1044,9 @@ vg_get_config(VuDev *dev, uint8_t *config, uint32_t len) { VuGpu *g = container_of(dev, VuGpu, dev.parent); - g_return_val_if_fail(len <= sizeof(struct virtio_gpu_config), -1); + if (len > sizeof(struct virtio_gpu_config)) { + return -1; + } if (opt_virgl) { g->virtio_config.num_capsets = vg_virgl_get_num_capsets(); |