Subject: Re: linux-next: build warning after merge of the vfs-brauner tree

From: Stephen Rothwell <[email-masked]>
Date: Wed, 6 Mar 2024 15:37:03 +1100

Hi all,

On Tue, 5 Mar 2024 18:48:30 -0800 Linus Torvalds <[email-masked]> wrote:
>
> On Tue, 5 Mar 2024 at 15:51, Stephen Rothwell <[email-masked]> wrote:
> >
> > fs/coredump.c: In function 'dump_user_range':
> > fs/coredump.c:923:40: warning: left-hand operand of comma expression has no effect [-Wunused-value]
> >   923 | #define dump_page_copy(src, dst) ((dst), (src))
> >       |                                        ^
> > fs/coredump.c:948:58: note: in expansion of macro 'dump_page_copy'
> >   948 |                         int stop = !dump_emit_page(cprm, dump_page_copy(page, dump_page));
> >       |                                                          ^~~~~~~~~~~~~~
> >
> > Introduced by commit
> >
> >   4630f2caafcd ("coredump: get machine check errors early rather than during iov_iter")  
> 
> Bah. If comes from that
> 
>   #define dump_page_copy(src,dst) ((dst),(src))
> 
> and I did it that way because I wanted to avoid *another* warning,
> namely the "dst not used" thing.
> 
> But it would have probably been better to either make it an inline
> function, or maybe an explicit cast, eg
> 
>   #define dump_page_copy(src,dst) ((void)(dst),(src))
> 
> or whatever.

This became a build failure for my i386 defconfig build, so I did this:

From: Stephen Rothwell <[email-masked]>
Date: Wed, 6 Mar 2024 15:28:12 +1100
Subject: [PATCH] fix up for "coredump: get machine check errors early rather
 than during iov_iter"

Signed-off-by: Stephen Rothwell <[email-masked]>
---
 fs/coredump.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/fs/coredump.c b/fs/coredump.c
index ea155ffee14c..5353b7ac67f2 100644
--- a/fs/coredump.c
+++ b/fs/coredump.c
@@ -920,7 +920,10 @@ static struct page *dump_page_copy(struct page *src, struct page *dst)
 
 #define dump_page_alloc() ((struct page *)8) // Not NULL
 #define dump_page_free(x) do { } while (0)
-#define dump_page_copy(src, dst) ((dst), (src))
+static struct page *dump_page_copy(struct page *src, struct page *dst)
+{
+        return NULL;
+}
 
 #endif
 
-- 
2.43.0

-- 
Cheers,
Stephen Rothwell