]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
samples/vfs: fix printf format string for size_t
authorArnd Bergmann <arnd@arndb.de>
Mon, 24 Feb 2025 14:14:00 +0000 (15:14 +0100)
committerChristian Brauner <brauner@kernel.org>
Tue, 25 Feb 2025 10:56:26 +0000 (11:56 +0100)
size_t needs a %z format string modifier instead of %l

samples/vfs/test-list-all-mounts.c:152:39: warning: format specifies type 'unsigned long' but the argument has type 'size_t' (aka 'unsigned int') [-Wformat]
  152 |                                         printf("mnt_uidmap[%lu]:\t%s\n", idx, idmap);
      |                                                            ~~~           ^~~
      |                                                            %zu
samples/vfs/test-list-all-mounts.c:161:39: warning: format specifies type 'unsigned long' but the argument has type 'size_t' (aka 'unsigned int') [-Wformat]
  161 |                                         printf("mnt_gidmap[%lu]:\t%s\n", idx, idmap);
      |                                                            ~~~           ^~~
      |                                                            %zu

Fixes: fa204a65f1b6 ("samples/vfs: add STATMOUNT_MNT_{G,U}IDMAP")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Link: https://lore.kernel.org/r/20250224141406.1400864-1-arnd@kernel.org
Signed-off-by: Christian Brauner <brauner@kernel.org>
samples/vfs/test-list-all-mounts.c

index bb3b83d8f1d7cdfab83d61fe4144c6dca4ee334d..713c174626aa55b9ee32959bc2a108ed363d3009 100644 (file)
@@ -149,7 +149,7 @@ next:
                                const char *idmap = stmnt->str + stmnt->mnt_uidmap;
 
                                for (size_t idx = 0; idx < stmnt->mnt_uidmap_num; idx++) {
-                                       printf("mnt_uidmap[%lu]:\t%s\n", idx, idmap);
+                                       printf("mnt_uidmap[%zu]:\t%s\n", idx, idmap);
                                        idmap += strlen(idmap) + 1;
                                }
                        }
@@ -158,7 +158,7 @@ next:
                                const char *idmap = stmnt->str + stmnt->mnt_gidmap;
 
                                for (size_t idx = 0; idx < stmnt->mnt_gidmap_num; idx++) {
-                                       printf("mnt_gidmap[%lu]:\t%s\n", idx, idmap);
+                                       printf("mnt_gidmap[%zu]:\t%s\n", idx, idmap);
                                        idmap += strlen(idmap) + 1;
                                }
                        }