* [PATCH] um: virtio-pci: Use pointer from memcpy() call for assignment in virtio_pcidev_send_cmd()
@ 2025-10-31 8:05 Markus Elfring
0 siblings, 0 replies; only message in thread
From: Markus Elfring @ 2025-10-31 8:05 UTC (permalink / raw)
To: linux-um, Anton Ivanov, Johannes Berg, Richard Weinberger,
Tiwei Bie
Cc: LKML, kernel-janitors, Miaoqian Lin
From: Markus Elfring <elfring@users.sourceforge.net>
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 <elfring@users.sourceforge.net>
---
arch/um/drivers/virtio_pcidev.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/arch/um/drivers/virtio_pcidev.c b/arch/um/drivers/virtio_pcidev.c
index f9b4b6f7582c..33f6889cce7b 100644
--- a/arch/um/drivers/virtio_pcidev.c
+++ b/arch/um/drivers/virtio_pcidev.c
@@ -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,
--
2.51.1
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2025-10-31 8:05 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-31 8:05 [PATCH] um: virtio-pci: Use pointer from memcpy() call for assignment in virtio_pcidev_send_cmd() Markus Elfring
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).