From: Markus Elfring <Markus.Elfring@web.de>
To: Naman Jain <namjain@linux.microsoft.com>,
linux-hyperv@vger.kernel.org, x86@kernel.org,
Borislav Petkov <bp@alien8.de>,
Dave Hansen <dave.hansen@linux.intel.com>,
Dexuan Cui <decui@microsoft.com>,
Haiyang Zhang <haiyangz@microsoft.com>,
"H. Peter Anvin" <hpa@zytor.com>, Ingo Molnar <mingo@redhat.com>,
"K. Y. Srinivasan" <kys@microsoft.com>,
Long Li <longli@microsoft.com>,
Mukesh Rathor <mrathor@linux.microsoft.com>,
Thomas Gleixner <tglx@linutronix.de>,
Wei Liu <wei.liu@kernel.org>
Cc: LKML <linux-kernel@vger.kernel.org>,
kernel-janitors@vger.kernel.org,
Miaoqian Lin <linmq006@gmail.com>
Subject: Re: [PATCH] x86/hyperv: Use pointer from memcpy() call for assignment in hv_crash_setup_trampdata()
Date: Fri, 31 Oct 2025 10:44:37 +0100 [thread overview]
Message-ID: <17da2cdc-7fdd-43d1-91d5-36425615588a@web.de> (raw)
In-Reply-To: <cea9d987-0231-4131-82ac-9ba8c852f963@linux.microsoft.com>
…>> +++ b/arch/x86/hyperv/hv_crash.c
>> @@ -464,9 +464,7 @@ static int hv_crash_setup_trampdata(u64 trampoline_va)
>> return -1;
>> }
>> - dest = (void *)trampoline_va;
>> - memcpy(dest, &hv_crash_asm32, size);
>> -
>> + dest = memcpy((void *)trampoline_va, &hv_crash_asm32, size);
>> dest += size;
>> dest = (void *)round_up((ulong)dest, 16);
>> tramp = (struct hv_crash_tramp_data *)dest;
>
>
> I tried running spatch Coccinelle checks on this file, but could not get it to flag this improvement.
The proposed source code transformation is not supported by a coccicheck script so far.
> Do you mind sharing more details on the issue reproduction please.
Would you like to take another look at corresponding development discussions?
Example:
[RFC] Increasing usage of direct pointer assignments from memcpy() calls with SmPL?
https://lore.kernel.org/cocci/ddc8654a-9505-451f-87ad-075bfa646381@web.de/
https://sympa.inria.fr/sympa/arc/cocci/2025-10/msg00049.html
> I am OK with this change,
Thanks for a bit of positive feedback.
> though it may cost code readability a little bit.
Would you complain about other variable assignments in such a direction?
Regards,
Markus
next prev parent reply other threads:[~2025-10-31 9:45 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-31 8:33 [PATCH] x86/hyperv: Use pointer from memcpy() call for assignment in hv_crash_setup_trampdata() Markus Elfring
2025-10-31 9:28 ` Naman Jain
2025-10-31 9:37 ` Julia Lawall
2025-10-31 9:44 ` Markus Elfring [this message]
2025-10-31 12:32 ` Naman Jain
2025-10-31 18:26 ` Wei Liu
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=17da2cdc-7fdd-43d1-91d5-36425615588a@web.de \
--to=markus.elfring@web.de \
--cc=bp@alien8.de \
--cc=dave.hansen@linux.intel.com \
--cc=decui@microsoft.com \
--cc=haiyangz@microsoft.com \
--cc=hpa@zytor.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=kys@microsoft.com \
--cc=linmq006@gmail.com \
--cc=linux-hyperv@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=longli@microsoft.com \
--cc=mingo@redhat.com \
--cc=mrathor@linux.microsoft.com \
--cc=namjain@linux.microsoft.com \
--cc=tglx@linutronix.de \
--cc=wei.liu@kernel.org \
--cc=x86@kernel.org \
/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