From: "Eric W. Biederman" <ebiederm@xmission.com>
To: Markus Elfring <Markus.Elfring@web.de>
Cc: linux-mips@vger.kernel.org, "Huacai Chen" <chenhuacai@kernel.org>,
"Jiaxun Yang" <jiaxun.yang@flygoat.com>,
"Jinyang He" <hejinyang@loongson.cn>,
"Thomas Bogendörfer" <tsbogend@alpha.franken.de>,
"Youling Tang" <tangyouling@loongson.cn>,
LKML <linux-kernel@vger.kernel.org>,
kernel-janitors@vger.kernel.org,
"Miaoqian Lin" <linmq006@gmail.com>
Subject: Re: [PATCH] MIPS: Loongson64: Use pointer from memcpy() call for assignment in loongson_kexec_prepare()
Date: Thu, 30 Oct 2025 22:19:20 -0500 [thread overview]
Message-ID: <877bwb21xj.fsf@email.froward.int.ebiederm.org> (raw)
In-Reply-To: <037fcb01-b723-42f3-b3e8-9a351e1caa47@web.de> (Markus Elfring's message of "Thu, 30 Oct 2025 20:57:29 +0100")
Markus Elfring <Markus.Elfring@web.de> writes:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Thu, 30 Oct 2025 20:48:11 +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.
Just looking at this change, I think this obscures things more than
clarifies things.
I believe the separate variable was used as much as anything to make
the line lengths shorter and the code more readable.
Eric
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
> ---
> arch/mips/loongson64/reset.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/arch/mips/loongson64/reset.c b/arch/mips/loongson64/reset.c
> index 3e20ade0503a..ce412f5616b7 100644
> --- a/arch/mips/loongson64/reset.c
> +++ b/arch/mips/loongson64/reset.c
> @@ -76,8 +76,9 @@ static int loongson_kexec_prepare(struct kimage *image)
> * of parameters (as bootloader does).
> */
> int offt;
> - str = (char *)argv + KEXEC_ARGV_SIZE/2;
> - memcpy(str, image->segment[i].buf, KEXEC_ARGV_SIZE/2);
> +
> + str = memcpy((char *)argv + KEXEC_ARGV_SIZE / 2, image->segment[i].buf,
> + KEXEC_ARGV_SIZE / 2);
> ptr = strchr(str, ' ');
>
> while (ptr && (argc < MAX_ARGS)) {
prev parent reply other threads:[~2025-10-31 3:19 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-30 19:57 Markus Elfring
2025-10-31 3:19 ` Eric W. Biederman [this message]
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=877bwb21xj.fsf@email.froward.int.ebiederm.org \
--to=ebiederm@xmission.com \
--cc=Markus.Elfring@web.de \
--cc=chenhuacai@kernel.org \
--cc=hejinyang@loongson.cn \
--cc=jiaxun.yang@flygoat.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=linmq006@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mips@vger.kernel.org \
--cc=tangyouling@loongson.cn \
--cc=tsbogend@alpha.franken.de \
/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
all inboxes | Powered by JetHome®