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

From: Jan Kara <[email-masked]>
Date: Mon, 1 Nov 2021 12:50:58 +0100

On Thu 28-10-21 21:10:53, Stephen Rothwell wrote:
> Hi all,
> 
> After merging the ext3 tree, today's linux-next build (powerpc
> allyesconfig) produced this warning:
> 
> samples/fanotify/fs-monitor.c: In function 'handle_notifications':
> samples/fanotify/fs-monitor.c:68:36: warning: format '%llx' expects argument of type 'long long unsigned int', but argument 2 has type '__u64' {aka 'long unsigned int'} [-Wformat=]
>    68 |    printf("unexpected FAN MARK: %llx\n", event->mask);
>       |                                 ~~~^     ~~~~~~~~~~~
>       |                                    |          |
>       |                                    |          __u64 {aka long unsigned int}
>       |                                    long long unsigned int
>       |                                 %lx
> 
> Introduced by commit
> 
>   5451093081db ("samples: Add fs error monitoring example")

Thanks for report Stephen. I've added attached patch to my tree to fix it
up.

									Honza
-- 
Jan Kara <[email-masked]>
SUSE Labs, CR
>From b7eccf75c28e5469bb4685a03310dbb66ee323f9 Mon Sep 17 00:00:00 2001
From: Jan Kara <[email-masked]>
Date: Mon, 1 Nov 2021 12:47:32 +0100
Subject: [PATCH] samples: Fix warning in fsnotify sample

The fsnotify sample code generates the following warning on powerpc:

samples/fanotify/fs-monitor.c: In function 'handle_notifications':
samples/fanotify/fs-monitor.c:68:36: warning: format '%llx' expects argument of type 'long long unsigned int', but argument 2 has type '__u64' {aka 'long unsigned int'} [-Wformat=]
   68 |    printf("unexpected FAN MARK: %llx\n", event->mask);
      |                                 ~~~^     ~~~~~~~~~~~
      |                                    |          |
      |                                    |          __u64 {aka long unsigned int}
      |                                    long long unsigned int
      |                                 %lx

Fix the problem by explicitely typing the argument to proper type.

Reported-by: Stephen Rothwell <[email-masked]>
Signed-off-by: Jan Kara <[email-masked]>
---
 samples/fanotify/fs-monitor.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/samples/fanotify/fs-monitor.c b/samples/fanotify/fs-monitor.c
index a0e44cd31e6f..2e08a1807db7 100644
--- a/samples/fanotify/fs-monitor.c
+++ b/samples/fanotify/fs-monitor.c
@@ -65,7 +65,8 @@ static void handle_notifications(char *buffer, int len)
 	for (; FAN_EVENT_OK(event, len); event = FAN_EVENT_NEXT(event, len)) {
 
 		if (event->mask != FAN_FS_ERROR) {
-			printf("unexpected FAN MARK: %llx\n", event->mask);
+			printf("unexpected FAN MARK: %llx\n",
+							(unsigned long long)event->mask);
 			goto next_event;
 		}
 
-- 
2.26.2