* [PATCH v2] m68k: Avoid -Wunused-but-set-parameter in clear_user_page()
@ 2026-05-25 8:33 Thomas Weißschuh
2026-05-25 19:54 ` Andrew Morton
0 siblings, 1 reply; 5+ messages in thread
From: Thomas Weißschuh @ 2026-05-25 8:33 UTC (permalink / raw)
To: Geert Uytterhoeven, David Hildenbrand (Red Hat),
Andrew Morton, Ankur Arora
Cc: linux-m68k, linux-kernel, Andreas Schwab, Thomas Weißschuh
The loop in clear_user_pages() iterates over all pages and calls
clear_user_page() for each of them. During the loop "vaddr" is modified.
However on m68k clear_user() is a macro which does not use "vaddr".
The compiler sees a variable which is modified but never used and emits
a warning for that:
include/linux/highmem.h: In function 'clear_user_pages':
include/linux/highmem.h:234:63: warning: parameter 'vaddr' set but not used [-Wunused-but-set-parameter=]
static inline void clear_user_pages(void *addr, unsigned long vaddr,
Other architectures use an inline function for clear_user_page() which
avoids the warning. This is not possible on m68k, as dlush_dcache_page()
is another macro which is not yet defined where clear_user_page() is
defined. Including cacheflush_mm.h will trigger recursive and lots of
other issues.
So hide the warning with a cast to (void) instead.
While we are here, do the same for copy_user_page().
Fixes: 62a9f5a85b98 ("mm: introduce clear_pages() and clear_user_pages()")
Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
---
Changes in v2:
- Put parens around vaddr.
- Link to v1: https://patch.msgid.link/20260524-m68k-clear_user_page-v1-1-4c950668842e@weissschuh.net
---
arch/m68k/include/asm/page_mm.h | 2 ++
1 file changed, 2 insertions(+)
diff --git a/arch/m68k/include/asm/page_mm.h b/arch/m68k/include/asm/page_mm.h
index ed782609ca41..0971a0651d49 100644
--- a/arch/m68k/include/asm/page_mm.h
+++ b/arch/m68k/include/asm/page_mm.h
@@ -55,10 +55,12 @@ static inline void clear_page(void *page)
#define clear_user_page(addr, vaddr, page) \
do { clear_page(addr); \
flush_dcache_page(page); \
+ (void)(vaddr); \
} while (0)
#define copy_user_page(to, from, vaddr, page) \
do { copy_page(to, from); \
flush_dcache_page(page); \
+ (void)(vaddr); \
} while (0)
extern unsigned long m68k_memoffset;
---
base-commit: eed108edc1170404bbef9e7d0189d18a3cc354f5
change-id: 20260523-m68k-clear_user_page-bf8063063f90
Best regards,
--
Thomas Weißschuh <linux@weissschuh.net>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v2] m68k: Avoid -Wunused-but-set-parameter in clear_user_page()
2026-05-25 8:33 [PATCH v2] m68k: Avoid -Wunused-but-set-parameter in clear_user_page() Thomas Weißschuh
@ 2026-05-25 19:54 ` Andrew Morton
2026-07-01 9:48 ` Geert Uytterhoeven
0 siblings, 1 reply; 5+ messages in thread
From: Andrew Morton @ 2026-05-25 19:54 UTC (permalink / raw)
To: Thomas Weißschuh
Cc: Geert Uytterhoeven, David Hildenbrand (Red Hat),
Ankur Arora, linux-m68k, linux-kernel, Andreas Schwab
On Mon, 25 May 2026 10:33:52 +0200 Thomas Weißschuh <linux@weissschuh.net> wrote:
> The loop in clear_user_pages() iterates over all pages and calls
> clear_user_page() for each of them. During the loop "vaddr" is modified.
> However on m68k clear_user() is a macro which does not use "vaddr".
> The compiler sees a variable which is modified but never used and emits
> a warning for that:
>
> include/linux/highmem.h: In function 'clear_user_pages':
> include/linux/highmem.h:234:63: warning: parameter 'vaddr' set but not used [-Wunused-but-set-parameter=]
> static inline void clear_user_pages(void *addr, unsigned long vaddr,
>
> Other architectures use an inline function for clear_user_page() which
> avoids the warning. This is not possible on m68k, as dlush_dcache_page()
> is another macro which is not yet defined where clear_user_page() is
> defined. Including cacheflush_mm.h will trigger recursive and lots of
> other issues.
>
> So hide the warning with a cast to (void) instead.
>
> While we are here, do the same for copy_user_page().
>
As with sparc, can this be addressed by converting these macros into
static inline C functions?
> --- a/arch/m68k/include/asm/page_mm.h
> +++ b/arch/m68k/include/asm/page_mm.h
> @@ -55,10 +55,12 @@ static inline void clear_page(void *page)
> #define clear_user_page(addr, vaddr, page) \
> do { clear_page(addr); \
> flush_dcache_page(page); \
> + (void)(vaddr); \
> } while (0)
> #define copy_user_page(to, from, vaddr, page) \
> do { copy_page(to, from); \
> flush_dcache_page(page); \
> + (void)(vaddr); \
> } while (0)
>
> extern unsigned long m68k_memoffset;
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v2] m68k: Avoid -Wunused-but-set-parameter in clear_user_page()
2026-05-25 19:54 ` Andrew Morton
@ 2026-07-01 9:48 ` Geert Uytterhoeven
2026-07-01 23:12 ` Andrew Morton
0 siblings, 1 reply; 5+ messages in thread
From: Geert Uytterhoeven @ 2026-07-01 9:48 UTC (permalink / raw)
To: Andrew Morton, Thomas Weißschuh
Cc: David Hildenbrand (Red Hat),
Ankur Arora, linux-m68k, linux-kernel, Andreas Schwab
Hi Andrew, Thomas,
On Mon, 25 May 2026 at 21:54, Andrew Morton <akpm@linux-foundation.org> wrote:
> On Mon, 25 May 2026 10:33:52 +0200 Thomas Weißschuh <linux@weissschuh.net> wrote:
> > The loop in clear_user_pages() iterates over all pages and calls
> > clear_user_page() for each of them. During the loop "vaddr" is modified.
> > However on m68k clear_user() is a macro which does not use "vaddr".
> > The compiler sees a variable which is modified but never used and emits
> > a warning for that:
> >
> > include/linux/highmem.h: In function 'clear_user_pages':
> > include/linux/highmem.h:234:63: warning: parameter 'vaddr' set but not used [-Wunused-but-set-parameter=]
> > static inline void clear_user_pages(void *addr, unsigned long vaddr,
> >
> > Other architectures use an inline function for clear_user_page() which
> > avoids the warning. This is not possible on m68k, as dlush_dcache_page()
> > is another macro which is not yet defined where clear_user_page() is
> > defined. Including cacheflush_mm.h will trigger recursive and lots of
> > other issues.
> >
> > So hide the warning with a cast to (void) instead.
> >
> > While we are here, do the same for copy_user_page().
> >
>
> As with sparc, can this be addressed by converting these macros into
> static inline C functions?
That would fail for similar reasons as on sparc: flush_dcache_page() is
not yet defined, and trying to include <asm/page.h> causes include hell.
> > --- a/arch/m68k/include/asm/page_mm.h
> > +++ b/arch/m68k/include/asm/page_mm.h
> > @@ -55,10 +55,12 @@ static inline void clear_page(void *page)
> > #define clear_user_page(addr, vaddr, page) \
> > do { clear_page(addr); \
> > flush_dcache_page(page); \
> > + (void)(vaddr); \
> > } while (0)
> > #define copy_user_page(to, from, vaddr, page) \
> > do { copy_page(to, from); \
> > flush_dcache_page(page); \
> > + (void)(vaddr); \
> > } while (0)
> >
> > extern unsigned long m68k_memoffset;
People are starting to report this, now gcc-16 is getting more
widespread use.
Andrew: can you please take this, or shall I queue it for m68k fixes
(I don't have any other fixes at the moment)?
Acked-by: Geert Uytterhoeven <geert@linux-m68k.org>
Thanks!
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v2] m68k: Avoid -Wunused-but-set-parameter in clear_user_page()
2026-07-01 9:48 ` Geert Uytterhoeven
@ 2026-07-01 23:12 ` Andrew Morton
2026-07-02 8:07 ` Geert Uytterhoeven
0 siblings, 1 reply; 5+ messages in thread
From: Andrew Morton @ 2026-07-01 23:12 UTC (permalink / raw)
To: Geert Uytterhoeven
Cc: Thomas Weißschuh, David Hildenbrand (Red Hat),
Ankur Arora, linux-m68k, linux-kernel, Andreas Schwab
On Wed, 1 Jul 2026 11:48:35 +0200 Geert Uytterhoeven <geert@linux-m68k.org> wrote:
> > > --- a/arch/m68k/include/asm/page_mm.h
> > > +++ b/arch/m68k/include/asm/page_mm.h
> > > @@ -55,10 +55,12 @@ static inline void clear_page(void *page)
> > > #define clear_user_page(addr, vaddr, page) \
> > > do { clear_page(addr); \
> > > flush_dcache_page(page); \
> > > + (void)(vaddr); \
> > > } while (0)
> > > #define copy_user_page(to, from, vaddr, page) \
> > > do { copy_page(to, from); \
> > > flush_dcache_page(page); \
> > > + (void)(vaddr); \
> > > } while (0)
> > >
> > > extern unsigned long m68k_memoffset;
>
> People are starting to report this, now gcc-16 is getting more
> widespread use.
>
> Andrew: can you please take this, or shall I queue it for m68k fixes
> (I don't have any other fixes at the moment)?
>
> Acked-by: Geert Uytterhoeven <geert@linux-m68k.org>
Sorry, this fell through a crack. I've queued it for 7.2-rcX,
cc:stable.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v2] m68k: Avoid -Wunused-but-set-parameter in clear_user_page()
2026-07-01 23:12 ` Andrew Morton
@ 2026-07-02 8:07 ` Geert Uytterhoeven
0 siblings, 0 replies; 5+ messages in thread
From: Geert Uytterhoeven @ 2026-07-02 8:07 UTC (permalink / raw)
To: Andrew Morton
Cc: Thomas Weißschuh, David Hildenbrand (Red Hat),
Ankur Arora, linux-m68k, linux-kernel, Andreas Schwab
Hi Andrew,
On Thu, 2 Jul 2026 at 01:12, Andrew Morton <akpm@linux-foundation.org> wrote:
> On Wed, 1 Jul 2026 11:48:35 +0200 Geert Uytterhoeven <geert@linux-m68k.org> wrote:
> > > > --- a/arch/m68k/include/asm/page_mm.h
> > > > +++ b/arch/m68k/include/asm/page_mm.h
> > > > @@ -55,10 +55,12 @@ static inline void clear_page(void *page)
> > > > #define clear_user_page(addr, vaddr, page) \
> > > > do { clear_page(addr); \
> > > > flush_dcache_page(page); \
> > > > + (void)(vaddr); \
> > > > } while (0)
> > > > #define copy_user_page(to, from, vaddr, page) \
> > > > do { copy_page(to, from); \
> > > > flush_dcache_page(page); \
> > > > + (void)(vaddr); \
> > > > } while (0)
> > > >
> > > > extern unsigned long m68k_memoffset;
> >
> > People are starting to report this, now gcc-16 is getting more
> > widespread use.
> >
> > Andrew: can you please take this, or shall I queue it for m68k fixes
> > (I don't have any other fixes at the moment)?
> >
> > Acked-by: Geert Uytterhoeven <geert@linux-m68k.org>
>
> Sorry, this fell through a crack. I've queued it for 7.2-rcX,
> cc:stable.
Thanks a lot!
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2026-07-02 8:07 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-05-25 8:33 [PATCH v2] m68k: Avoid -Wunused-but-set-parameter in clear_user_page() Thomas Weißschuh
2026-05-25 19:54 ` Andrew Morton
2026-07-01 9:48 ` Geert Uytterhoeven
2026-07-01 23:12 ` Andrew Morton
2026-07-02 8:07 ` Geert Uytterhoeven
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox