[PATCH] virtio-iommu: Fix coverity issue in virtio_iommu_handle_command()

Eric Auger posted 1 patch 5 years, 4 months ago
Test checkpatch passed
Test docker-mingw@fedora passed
Test FreeBSD passed
Test docker-quick@centos7 passed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20200708160147.18426-1-eric.auger@redhat.com
Maintainers: "Michael S. Tsirkin" <mst@redhat.com>, Eric Auger <eric.auger@redhat.com>
hw/virtio/virtio-iommu.c | 1 +
1 file changed, 1 insertion(+)
[PATCH] virtio-iommu: Fix coverity issue in virtio_iommu_handle_command()
Posted by Eric Auger 5 years, 4 months ago
Coverity points out (CID 1430180) that the new case is missing
break or a /* fallthrough */ comment. Break is the right thing to
do as in that case, tail is not used.

Fixes 1733eebb9e ("virtio-iommu: Implement RESV_MEM probe request")
Signed-off-by: Eric Auger <eric.auger@redhat.com>
Reported-by: Peter Maydell <peter.maydell@linaro.org>
---
 hw/virtio/virtio-iommu.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/hw/virtio/virtio-iommu.c b/hw/virtio/virtio-iommu.c
index b39e836181..5d56865e56 100644
--- a/hw/virtio/virtio-iommu.c
+++ b/hw/virtio/virtio-iommu.c
@@ -534,6 +534,7 @@ static void virtio_iommu_handle_command(VirtIODevice *vdev, VirtQueue *vq)
             ptail = (struct virtio_iommu_req_tail *)
                         (buf + s->config.probe_size);
             ptail->status = virtio_iommu_handle_probe(s, iov, iov_cnt, buf);
+            break;
         }
         default:
             tail.status = VIRTIO_IOMMU_S_UNSUPP;
-- 
2.21.3


Re: [PATCH] virtio-iommu: Fix coverity issue in virtio_iommu_handle_command()
Posted by Peter Maydell 5 years, 4 months ago
On Wed, 8 Jul 2020 at 17:02, Eric Auger <eric.auger@redhat.com> wrote:
>
> Coverity points out (CID 1430180) that the new case is missing
> break or a /* fallthrough */ comment. Break is the right thing to
> do as in that case, tail is not used.
>
> Fixes 1733eebb9e ("virtio-iommu: Implement RESV_MEM probe request")
> Signed-off-by: Eric Auger <eric.auger@redhat.com>
> Reported-by: Peter Maydell <peter.maydell@linaro.org>
> ---
>  hw/virtio/virtio-iommu.c | 1 +
>  1 file changed, 1 insertion(+)



Applied to target-arm.next, thanks.

-- PMM