aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWilliam Henderson <william.henderson@nutanix.com>2023-07-24 08:31:10 +0000
committerJohn Levon <john.levon@nutanix.com>2023-09-15 12:59:39 +0100
commit75664e54ca374a72ff0595f59c3929e87b1a0003 (patch)
tree46ee48849f05f2961cbfddfb2862d617b8f339ee
parent5ab273df1296662a14a0de1389475f723f0498cf (diff)
downloadlibvfio-user-75664e54ca374a72ff0595f59c3929e87b1a0003.zip
libvfio-user-75664e54ca374a72ff0595f59c3929e87b1a0003.tar.gz
libvfio-user-75664e54ca374a72ff0595f59c3929e87b1a0003.tar.bz2
fix: prevent uninitialized return value
Signed-off-by: William Henderson <william.henderson@nutanix.com>
-rw-r--r--lib/libvfio-user.c6
1 files changed, 6 insertions, 0 deletions
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;