# Re: \[PATCH\] unwind: Show that entries of struct unwind\_cache is not bound by nr\_entries

- From: Steven Rostedt \<rostedt@goodmis.org\>
- Date: 2025-12-17 20:10:32 
- List: linux-trace-kernel
- Page: https://ratatoskr.run/linux-trace-kernel/2025/12/3337716
- Thread: https://ratatoskr.run/linux-trace-kernel/2025/11/3297435/t.md

```text
On Mon, 17 Nov 2025 13:28:59 -0800
Kees Cook [ref] wrote:

> struct unwind_cache {
> 	struct_group_tagged(unwind_cache_hdr, hdr,
> 		unsigned long unwind_completed;
> 		unsigned int  nr_entries;
> 	);
> 	unsigned long         entries[(SZ_4K - sizeof(struct unwind_cache_hdr)) / sizeof(long)];
> };

This may help automated tooling, but it is horrendous to read. I value
readability much higher than static analyzers.

Hence, I'm leaving the code as is, and just keep NAKing patches that try to
add __counted_by() to entries.

-- Steve


> 
> #define UNWIND_MAX_ENTRIES ARRAY_SIZE(((struct unwind_cache*)NULL)->entries)
> 
> And this checks out for me:
> 
> UNWIND_MAX_ENTRIES:510
> sizeof(struct unwind_cache):4096
> 
> No hiding things from the compiler, and you can treat "entries" like a
> real array (since it is one now).

```
