On Fri, Apr 10, 2026 at 01:16:27PM +0300, Dan Carpenter wrote:
> Hello Vincent Donnefort,
> 
> Commit 2e67fabd8b77 ("ring-buffer: Introduce ring-buffer remotes")
> from Mar 9, 2026 (linux-next), leads to the following Smatch static
> checker warning:
> 
>       kernel/trace/ring_buffer.c:2243 ring_buffer_desc_page()
>       warn: array off by one? 'desc->page_va[page_id]'
> 
> kernel/trace/ring_buffer.c
>     2241 static void *ring_buffer_desc_page(struct ring_buffer_desc *desc, 
> int page_id)
>     2242 {
> --> 2243         return page_id > desc->nr_page_va ? NULL : (void 
> *)desc->page_va[page_id];
>                                 ^
> Based on the len = struct_size(desc, page_va, desc->nr_page_va), in
> ring_buffer_desc(), I'm pretty sure this should be >= instead of >.

You are right. Thanks for the report, I have sent a fix.

> 
>     2244 }
> 
> This email is a free service from the Smatch-CI project [smatch.sf.net].
> 
> regards,
> dan carpenter

Reply via email to