[<prev] [next>] [day] [month] [year] [list]
Message-ID: <3b2e9b4e-4186-4d05-836f-73e1203f34d7@web.de>
Date: Fri, 31 Oct 2025 09:05:21 +0100
From: Markus Elfring <Markus.Elfring@....de>
To: linux-um@...ts.infradead.org,
Anton Ivanov <anton.ivanov@...bridgegreys.com>,
Johannes Berg <johannes@...solutions.net>,
Richard Weinberger <richard@....at>, Tiwei Bie <tiwei.btw@...group.com>
Cc: LKML <linux-kernel@...r.kernel.org>, kernel-janitors@...r.kernel.org,
Miaoqian Lin <linmq006@...il.com>
Subject: [PATCH] um: virtio-pci: Use pointer from memcpy() call for assignment
in virtio_pcidev_send_cmd()
From: Markus Elfring <elfring@...rs.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@...rs.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
Powered by blists - more mailing lists