Re: [PATCH v6 5/5] coccinelle: Add kmalloc_objs conversion script
From: Julia Lawall
Date: Sun Feb 22 2026 - 04:33:02 EST
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 <kees@xxxxxxxxxx>
> > ---
> > Cc: Julia Lawall <Julia.Lawall@xxxxxxxx>
> > Cc: Nicolas Palix <nicolas.palix@xxxxxxx>
> > Cc: cocci@xxxxxxxx
> > ---
> > 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.
>