Re: [PATCH v6 5/5] coccinelle: Add kmalloc_objs conversion script
On Sat, 21 Feb 2026, Eric Biggers wrote: > On Wed, Dec 03, 2025 at 03:30:35PM -0800, Kees Cook wrote: > > Finds and converts sized kmalloc-family of allocations into the > > typed kmalloc_obj-family of allocations. > > > > Signed-off-by: Kees Cook > > --- > > Cc: Julia Lawall > > Cc: Nicolas Palix > > Cc: [email protected] > > --- > > scripts/coccinelle/api/kmalloc_objs.cocci | 109 ++ > > 1 file changed, 109 insertions(+) > > create mode 100644 scripts/coccinelle/api/kmalloc_objs.cocci > > Is there a way to reproduce commit 69050f8d6d075dc using this semantic > patch as claimed? I spend a while installing the latest version of > spatch (which was quite hard to do due to all the unusual dependencies), > but it complains that no rules apply: I guess you would have to write on the command line -D patch? julia > > $ /usr/local/bin/spatch --sp-file scripts/coccinelle/api/kmalloc_objs.cocci > --dir . --in-place > init_defs_builtins: /usr/local/lib/coccinelle/standard.h > SPECIAL NAMES: adding u8 as a type > SPECIAL NAMES: adding u16 as a type > SPECIAL NAMES: adding u32 as a type > SPECIAL NAMES: adding u64 as a type > SPECIAL NAMES: adding __u8 as a type > SPECIAL NAMES: adding __u16 as a type > SPECIAL NAMES: adding __u32 as a type > SPECIAL NAMES: adding __u64 as a type > SPECIAL NAMES: adding uint8_t as a type > SPECIAL NAMES: adding uint16_t as a type > SPECIAL NAMES: adding uint32_t as a type > SPECIAL NAMES: adding uint64_t as a type > SPECIAL NAMES: adding uchar as a type > SPECIAL NAMES: adding ushort as a type > SPECIAL NAMES: adding uint as a type > SPECIAL NAMES: adding ulong as a type > SPECIAL NAMES: adding __le16 as a type > SPECIAL NAMES: adding __le32 as a type > SPECIAL NAMES: adding __le64 as a type > SPECIAL NAMES: adding __be16 as a type > SPECIAL NAMES: adding __be32 as a type > SPECIAL NAMES: adding __be64 as a type > SPECIAL NAMES: adding wchar_t as a type > No rules apply. Perhaps your semantic patch doesn't contain any +/-/* code, > or you have a failed dependency. If the problem is not clear, try > --debug-parse-cocci or check whether any virtual rules (e.g., patch) should > be defined. >
Re: [PATCH v6 5/5] coccinelle: Add kmalloc_objs conversion script
On Sat, Feb 21, 2026 at 08:13:24PM -0800, Eric Biggers wrote: > On Wed, Dec 03, 2025 at 03:30:35PM -0800, Kees Cook wrote: > > Finds and converts sized kmalloc-family of allocations into the > > typed kmalloc_obj-family of allocations. > > > > Signed-off-by: Kees Cook > > --- > > Cc: Julia Lawall > > Cc: Nicolas Palix > > Cc: [email protected] > > --- > > scripts/coccinelle/api/kmalloc_objs.cocci | 109 ++ > > 1 file changed, 109 insertions(+) > > create mode 100644 scripts/coccinelle/api/kmalloc_objs.cocci > > Is there a way to reproduce commit 69050f8d6d075dc using this semantic > patch as claimed? I spend a while installing the latest version of > spatch (which was quite hard to do due to all the unusual dependencies), > but it complains that no rules apply: > > $ /usr/local/bin/spatch --sp-file scripts/coccinelle/api/kmalloc_objs.cocci > --dir . --in-place > init_defs_builtins: /usr/local/lib/coccinelle/standard.h > SPECIAL NAMES: adding u8 as a type > SPECIAL NAMES: adding u16 as a type > SPECIAL NAMES: adding u32 as a type > SPECIAL NAMES: adding u64 as a type > SPECIAL NAMES: adding __u8 as a type > SPECIAL NAMES: adding __u16 as a type > SPECIAL NAMES: adding __u32 as a type > SPECIAL NAMES: adding __u64 as a type > SPECIAL NAMES: adding uint8_t as a type > SPECIAL NAMES: adding uint16_t as a type > SPECIAL NAMES: adding uint32_t as a type > SPECIAL NAMES: adding uint64_t as a type > SPECIAL NAMES: adding uchar as a type > SPECIAL NAMES: adding ushort as a type > SPECIAL NAMES: adding uint as a type > SPECIAL NAMES: adding ulong as a type > SPECIAL NAMES: adding __le16 as a type > SPECIAL NAMES: adding __le32 as a type > SPECIAL NAMES: adding __le64 as a type > SPECIAL NAMES: adding __be16 as a type > SPECIAL NAMES: adding __be32 as a type > SPECIAL NAMES: adding __be64 as a type > SPECIAL NAMES: adding wchar_t as a type > No rules apply. Perhaps your semantic patch doesn't contain any +/-/* code, > or you have a failed dependency. If the problem is not clear, try > --debug-parse-cocci or check whether any virtual rules (e.g., patch) should > be defined. I'm running: $ spatch --version spatch version 1.1.1-00467-g578998d7826c compiled with OCaml version 4.13.1 Running Coccinelle scripts is normally done with the coccicheck target: $ make coccicheck V=1 MODE=patch COCCI=scripts/coccinelle/api/kmalloc_objs.cocci -Kees -- Kees Cook
Re: [PATCH v6 5/5] coccinelle: Add kmalloc_objs conversion script
On Wed, Dec 03, 2025 at 03:30:35PM -0800, Kees Cook wrote: > Finds and converts sized kmalloc-family of allocations into the > typed kmalloc_obj-family of allocations. > > Signed-off-by: Kees Cook > --- > Cc: Julia Lawall > Cc: Nicolas Palix > Cc: [email protected] > --- > scripts/coccinelle/api/kmalloc_objs.cocci | 109 ++ > 1 file changed, 109 insertions(+) > create mode 100644 scripts/coccinelle/api/kmalloc_objs.cocci Is there a way to reproduce commit 69050f8d6d075dc using this semantic patch as claimed? I spend a while installing the latest version of spatch (which was quite hard to do due to all the unusual dependencies), but it complains that no rules apply: $ /usr/local/bin/spatch --sp-file scripts/coccinelle/api/kmalloc_objs.cocci --dir . --in-place init_defs_builtins: /usr/local/lib/coccinelle/standard.h SPECIAL NAMES: adding u8 as a type SPECIAL NAMES: adding u16 as a type SPECIAL NAMES: adding u32 as a type SPECIAL NAMES: adding u64 as a type SPECIAL NAMES: adding __u8 as a type SPECIAL NAMES: adding __u16 as a type SPECIAL NAMES: adding __u32 as a type SPECIAL NAMES: adding __u64 as a type SPECIAL NAMES: adding uint8_t as a type SPECIAL NAMES: adding uint16_t as a type SPECIAL NAMES: adding uint32_t as a type SPECIAL NAMES: adding uint64_t as a type SPECIAL NAMES: adding uchar as a type SPECIAL NAMES: adding ushort as a type SPECIAL NAMES: adding uint as a type SPECIAL NAMES: adding ulong as a type SPECIAL NAMES: adding __le16 as a type SPECIAL NAMES: adding __le32 as a type SPECIAL NAMES: adding __le64 as a type SPECIAL NAMES: adding __be16 as a type SPECIAL NAMES: adding __be32 as a type SPECIAL NAMES: adding __be64 as a type SPECIAL NAMES: adding wchar_t as a type No rules apply. Perhaps your semantic patch doesn't contain any +/-/* code, or you have a failed dependency. If the problem is not clear, try --debug-parse-cocci or check whether any virtual rules (e.g., patch) should be defined.
Re: [PATCH v6 5/5] coccinelle: Add kmalloc_objs conversion script
On Thu, Dec 11, 2025 at 03:15:08PM +0100, Markus Elfring wrote: > > Finds and converts sized kmalloc-family of allocations into the > > typed kmalloc_obj-family of allocations. > > Can previous patch review concerns get more development attention anyhow? > https://lore.kernel.org/cocci/[email protected]/ > https://sympa.inria.fr/sympa/arc/cocci/2025-11/msg00066.html I've replied there now. tl;dr: I already dropped the empty Comments line for this v5, and didn't want to make other changes to the .cocci without a better rationale. I'm open to suggestions, though! -Kees -- Kees Cook
Re: [PATCH v6 5/5] coccinelle: Add kmalloc_objs conversion script
> Finds and converts sized kmalloc-family of allocations into the > typed kmalloc_obj-family of allocations. Can previous patch review concerns get more development attention anyhow? https://lore.kernel.org/cocci/[email protected]/ https://sympa.inria.fr/sympa/arc/cocci/2025-11/msg00066.html Regards, Markus
