From d406add6f37b0ed452d4f4e8f0653b22151ef4ee Mon Sep 17 00:00:00 2001 From: F6BVP Date: Fri, 18 Sep 2026 15:38:28 +0200 Subject: [PATCH] hamradio: always override the alloc_objs compat shims Some vendor kernels (Raspberry Pi Foundation 6.18.x) already backport kmalloc_obj/kzalloc_obj natively but with a mandatory GFP argument and no variadic default, breaking every 1-argument call site in this tree when the previous '#ifndef __alloc_objs' guard skipped our own variadic-friendly definitions. Always #undef and redefine instead of trusting the host kernel's version. Deployed and running since 2026-09-14/15 on f6bvp-8 and f6bvp-10 (Raspberry Pi OS, kernel 6.18.x), the two nodes where this vendor backport is actually present; no effect on nodes built against plain upstream headers. Signed-off-by: F6BVP --- include/hamradio_compat.h | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/include/hamradio_compat.h b/include/hamradio_compat.h index 66c98ec..fdff2a6 100644 --- a/include/hamradio_compat.h +++ b/include/hamradio_compat.h @@ -7,11 +7,24 @@ #include /* - * Compat shims for kzalloc_obj/kmalloc_obj/kzalloc_objs/kmalloc_objs - * which were added in kernels newer than 6.x. If the kernel already - * has them (detected via __alloc_objs), skip the definitions. + * Compat shims for kzalloc_obj/kmalloc_obj/kzalloc_objs/kmalloc_objs, + * with an optional GFP argument (defaulting to GFP_KERNEL) that every + * call site in this tree relies on. + * + * Some vendor kernels (e.g. Raspberry Pi Foundation's 6.18.x) already + * backport __alloc_objs()/kmalloc_obj()/etc. natively, but with a + * mandatory GFP argument and no variadic default. Skipping our own + * definitions in that case (the previous "#ifndef __alloc_objs" guard) + * left the vendor's incompatible, GFP-mandatory macros in place and + * broke every 1-argument call site in this tree. Always #undef and + * redefine our own variadic versions instead of trusting whatever the + * host kernel provides. */ -#ifndef __alloc_objs +#undef __alloc_objs +#undef kmalloc_obj +#undef kmalloc_objs +#undef kzalloc_obj +#undef kzalloc_objs #define __default_gfp_compat(a, b, ...) b #define default_gfp_compat(...) __default_gfp_compat(, ##__VA_ARGS__, GFP_KERNEL) @@ -34,8 +47,6 @@ #define kzalloc_objs(P, COUNT, ...) \ __alloc_objs(kzalloc, default_gfp_compat(__VA_ARGS__), typeof(P), COUNT) -#endif /* __alloc_objs */ - /* * struct sockaddr_unsized was introduced in Linux 7.0 to replace struct sockaddr * in proto_ops .bind/.connect callbacks. Map it to struct sockaddr on older kernels.