Re: linux-next: build warning after merge of the ftrace tree
From: Steven Rostedt
Date: Wed May 15 2024 - 01:01:56 EST
On Wed, 15 May 2024 00:49:31 -0400
Steven Rostedt <rostedt@xxxxxxxxxxx> wrote:
> > kernel/trace/ring_buffer.c:6286:72: warning: passing argument 1 of 'virt_to_pfn' makes pointer from integer without a cast [-Wint-conversion]
> > 6286 | struct page *page = virt_to_page(cpu_buffer->subbuf_ids[s]);
> > | ~~~~~~~~~~~~~~~~~~~~~~^~~
> > | |
> > | long unsigned int
> > include/asm-generic/memory_model.h:37:45: note: in definition of macro '__pfn_to_page'
> > 37 | #define __pfn_to_page(pfn) (vmemmap + (pfn))
> > | ^~~
> > kernel/trace/ring_buffer.c:6286:37: note: in expansion of macro 'virt_to_page'
> > 6286 | struct page *page = virt_to_page(cpu_buffer->subbuf_ids[s]);
> > | ^~~~~~~~~~~~
> > arch/powerpc/include/asm/page.h:228:53: note: expected 'const void *' but argument is of type 'long unsigned int'
> > 228 | static inline unsigned long virt_to_pfn(const void *kaddr)
> > | ~~~~~~~~~~~~^~~~~
> >
> > Introduced by commit
> >
> > 117c39200d9d ("ring-buffer: Introducing ring-buffer mapping functions")
> >
> > My arm multi_v7_defconfig build produced a similar warning.
> >
> > Is this really intended for v6.10? It seems a bit late.
> >
>
> Well, I submitted this for the v6.9 merge window, and Linus had issues
> with it. So we've been tweaking it for the entire time and it was ready
> a bit earlier, but due to my vacation and traveling I missed pushing it
> to next. :-p
>
> Most the code has been well tested, but because it is late, I kept it
> as a separate topic branch in case Linus still isn't happy with it.
And it looks like one of the "tweaks" dropped a (void *) cast.
This should fixed it:
diff --git a/kernel/trace/ring_buffer.c b/kernel/trace/ring_buffer.c
index a02c7a52a0f5..7345a8b625fb 100644
--- a/kernel/trace/ring_buffer.c
+++ b/kernel/trace/ring_buffer.c
@@ -6283,7 +6283,7 @@ static int __rb_map_vma(struct ring_buffer_per_cpu *cpu_buffer,
}
while (p < nr_pages) {
- struct page *page = virt_to_page(cpu_buffer->subbuf_ids[s]);
+ struct page *page = virt_to_page((void *)cpu_buffer->subbuf_ids[s]);
int off = 0;
if (WARN_ON_ONCE(s >= nr_subbufs)) {
-- Steve