From: Markus Elfring <Markus.Elfring@web.de>
To: cocci@inria.fr
Cc: LKML <linux-kernel@vger.kernel.org>,
kernel-janitors@vger.kernel.org,
Miaoqian Lin <linmq006@gmail.com>
Subject: [cocci] [RFC] Increasing usage of direct pointer assignments from memcpy() calls with SmPL?
Date: Wed, 29 Oct 2025 20:56:26 +0100 [thread overview]
Message-ID: <ddc8654a-9505-451f-87ad-075bfa646381@web.de> (raw)
Hello,
I got into the mood to try another simple source code transformation out which
can be achieved also by the means of the semantic patch language.
@replacement@
expression object, size, source, target;
@@
target =
- object;
memcpy(
- target
+ object
, source,
size);
Test result (according to the software combination “Coccinelle 1.3.0”):
Markus_Elfring@Sonne:…/Projekte/Linux/next-analyses> time /usr/bin/spatch --max-width 100 --timeout 23 -j4 --chunksize 1 --no-loops -dir . …/Projekte/Coccinelle/janitor/use_memcpy_assignment.cocci > …/Projekte/Bau/Linux/scripts/Coccinelle/use_memcpy_assignment-no_loops-20251029.diff 2> …/Projekte/Bau/Linux/scripts/Coccinelle/use_memcpy_assignment-no_loops-errors-20251029.txt
real 5m35,579s
user 20m20,037s
sys 0m14,467s
It can be determined then from the generated diff file that mentioned
implementation details can be transformed in 304 source files at the moment.
Thus I became curious if it would be supported to adjust any places there
according to (Linux) coding style preferences.
Regards,
Markus
next reply other threads:[~2025-10-29 19:56 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-29 19:56 Markus Elfring [this message]
2025-10-29 21:24 ` [cocci] [RFC] Increasing usage of direct pointer assignments from memcpy() calls with SmPL? Julia Lawall
2025-10-30 9:33 ` Markus Elfring
2025-10-30 10:12 ` Julia Lawall
2025-10-30 10:19 ` Markus Elfring
2025-10-30 10:32 ` Julia Lawall
2025-10-30 12:26 ` Markus Elfring
2025-10-30 12:31 ` Julia Lawall
2025-10-30 13:35 ` Markus Elfring
2025-10-30 13:38 ` Julia Lawall
2025-10-30 13:47 ` Dan Carpenter
2025-10-30 13:58 ` Markus Elfring
2025-10-31 6:00 ` Markus Elfring
2025-10-30 14:06 ` Markus Elfring
2025-10-30 14:14 ` Julia Lawall
2025-10-30 14:22 ` Markus Elfring
2025-10-31 16:57 ` Markus Elfring
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=ddc8654a-9505-451f-87ad-075bfa646381@web.de \
--to=markus.elfring@web.de \
--cc=cocci@inria.fr \
--cc=kernel-janitors@vger.kernel.org \
--cc=linmq006@gmail.com \
--cc=linux-kernel@vger.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