From 75664e54ca374a72ff0595f59c3929e87b1a0003 Mon Sep 17 00:00:00 2001 From: William Henderson Date: Mon, 24 Jul 2023 08:31:10 +0000 Subject: fix: prevent uninitialized return value Signed-off-by: William Henderson --- lib/libvfio-user.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/libvfio-user.c b/lib/libvfio-user.c index f11cdfe..5402436 100644 --- a/lib/libvfio-user.c +++ b/lib/libvfio-user.c @@ -1010,6 +1010,8 @@ handle_device_feature(vfu_ctx_t *vfu_ctx, vfu_msg_t *msg) struct vfio_user_device_feature *res = msg->out.iov.iov_base; ret = dma_feature_get(vfu_ctx, feature, res->data); + } else { + return -1; } } else if (req->flags & VFIO_DEVICE_FEATURE_SET) { msg->out.iov.iov_base = malloc(msg->in.iov.iov_len); @@ -1028,7 +1030,11 @@ handle_device_feature(vfu_ctx_t *vfu_ctx, vfu_msg_t *msg) ret = migration_feature_set(vfu_ctx, feature, res->data); } else if (is_dma_feature(feature)) { ret = dma_feature_set(vfu_ctx, feature, res->data); + } else { + return -1; } + } else { + return -1; } return ret; -- cgit v1.1