On Fri, 14 Nov 2025 10:49:52 -0500 Steven Rostedt <[email protected]> wrote:
> On Fri, 14 Nov 2025 09:56:44 -0500 > Steven Rostedt <[email protected]> wrote: > > > > > > > > unsigned int nr_entries; > > > > - unsigned long entries[]; > > > > + unsigned long entries[]; /* Fixed size, not bound by > > > > nr_entries */ > > > > }; > > > > > > Perhaps it should be: > > > unsigned long entries[ /* MAX_UNWIND_ENTRIES */ ]; > > > > Whatever would keep the coccinelle folks from sending more patches. > > Thorsten, > > Which comment would you feel is more obvious that entries is not bound by > nr_entries and prevent this patch from being sent again? > Or we can simply move the macro to the header: diff --git a/include/linux/unwind_deferred_types.h b/include/linux/unwind_deferred_types.h index 18fa3932f61c..0e43556b9710 100644 --- a/include/linux/unwind_deferred_types.h +++ b/include/linux/unwind_deferred_types.h @@ -5,10 +5,14 @@ #include <linux/types.h> #include <linux/atomic.h> +/* Make the cache fit in a 4K page */ +#define UNWIND_MAX_ENTRIES \ + ((SZ_4K - sizeof(struct unwind_cache)) / sizeof(long)) + struct unwind_cache { unsigned long unwind_completed; unsigned int nr_entries; - unsigned long entries[]; + unsigned long entries[ /* UNWIND_MAX_ENTRIES */ ]; }; /* diff --git a/kernel/unwind/deferred.c b/kernel/unwind/deferred.c index a88fb481c4a3..6ea7cb5f336d 100644 --- a/kernel/unwind/deferred.c +++ b/kernel/unwind/deferred.c @@ -37,10 +37,6 @@ static inline bool try_assign_cnt(struct unwind_task_info *info, u32 cnt) } #endif -/* Make the cache fit in a 4K page */ -#define UNWIND_MAX_ENTRIES \ - ((SZ_4K - sizeof(struct unwind_cache)) / sizeof(long)) - /* Guards adding to or removing from the list of callbacks */ static DEFINE_MUTEX(callback_mutex); static LIST_HEAD(callbacks); -- Steve
