um: virtio-pci: Use pointer from memcpy() call for assignment in virtio_pcidev_send_cmd()
Subsystems (2)
PATCH 1/1 um: virtio-pci: Use pointer from memcpy() call for assignment in virtio_pcidev_send_cmd()
From: Markus Elfring <[email protected]>
Date: Fri, 31 Oct 2025 08:58:22 +0100
A pointer was assigned to a variable. The same pointer was used for the destination parameter of a memcpy() call.
This function is documented in the way that the same value is returned. Thus convert two separate statements into a direct variable assignment for the return value from a memory copy action.
The source code was transformed by using the Coccinelle software.
Signed-off-by Markus Elfring <[email protected]>
--- arch/um/drivers/virtio_pcidev.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
arch/um/drivers/virtio_pcidev.c +1 -2
@@ -125,8 +125,7 @@ static int virtio_pcidev_send_cmd(struct virtio_pcidev_device *dev, out && out_size <=sizeof (buf->data); buf_idx =virtio_pcidev_get_buf (dev, &posted); - buf = &dev->bufs[buf_idx]; -memcpy (buf, cmd, cmd_size); + buf =memcpy (&dev->bufs[buf_idx], cmd, cmd_size);if (posted && extra && extra_size >sizeof (buf) - cmd_size) { dev->extra_ptrs[buf_idx] = kmemdup(extra, extra_size,
Signature · 1 line
2.51.1