From: Markus Elfring <Markus.Elfring@web.de>
To: linux-um@lists.infradead.org,
Anton Ivanov <anton.ivanov@cambridgegreys.com>,
Johannes Berg <johannes@sipsolutions.net>,
Richard Weinberger <richard@nod.at>,
Tiwei Bie <tiwei.btw@antgroup.com>
Cc: LKML <linux-kernel@vger.kernel.org>,
kernel-janitors@vger.kernel.org,
Miaoqian Lin <linmq006@gmail.com>
Subject: [PATCH] um: virtio-pci: Use pointer from memcpy() call for assignment in virtio_pcidev_send_cmd()
Date: Fri, 31 Oct 2025 09:05:21 +0100 [thread overview]
Message-ID: <3b2e9b4e-4186-4d05-836f-73e1203f34d7@web.de> (raw)
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
reply other threads:[~2025-10-31 8:05 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3b2e9b4e-4186-4d05-836f-73e1203f34d7@web.de \
--to=markus.elfring@web.de \
--cc=anton.ivanov@cambridgegreys.com \
--cc=johannes@sipsolutions.net \
--cc=kernel-janitors@vger.kernel.org \
--cc=linmq006@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-um@lists.infradead.org \
--cc=richard@nod.at \
--cc=tiwei.btw@antgroup.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).