From ffdd1d68d9a8975f20d73637e4ff39bb64d00efb Mon Sep 17 00:00:00 2001 From: John Levon Date: Thu, 12 May 2022 16:53:05 +0100 Subject: run scan-build in CI (#680) Yet another static analyzer pass, this one is used by SPDK, and as it did detect some minor issues, it's worth running. Signed-off-by: John Levon Reviewed-by: Thanos Makatos --- lib/libvfio-user.c | 2 +- lib/tran_pipe.c | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/libvfio-user.c b/lib/libvfio-user.c index 5b95865..fd2465d 100644 --- a/lib/libvfio-user.c +++ b/lib/libvfio-user.c @@ -469,7 +469,7 @@ vfu_create_ioeventfd(vfu_ctx_t *vfu_ctx, uint32_t region_idx, int fd, size_t offset, uint32_t size, uint32_t flags, uint64_t datamatch) { - vfu_reg_info_t *vfu_reg = &vfu_ctx->reg_info[region_idx]; + vfu_reg_info_t *vfu_reg; assert(vfu_ctx != NULL); assert(fd >= 0); diff --git a/lib/tran_pipe.c b/lib/tran_pipe.c index 34dd075..dea2c3c 100644 --- a/lib/tran_pipe.c +++ b/lib/tran_pipe.c @@ -73,6 +73,10 @@ tran_pipe_send_iovec(int fd, uint16_t msg_id, bool is_reply, ret = writev(fd, iovecs, nr_iovecs); + /* Quieten static analysis. */ + iovecs[0].iov_base = NULL; + iovecs[0].iov_len = 0; + if (ret == -1) { /* Treat a failed write due to EPIPE the same as a short write. */ if (errno == EPIPE) { -- cgit v1.1