* [brauner-vfs:work.mnt_idmap.statmount 4/5] 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')
@ 2025-01-30 21:09 kernel test robot
0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2025-01-30 21:09 UTC (permalink / raw)
To: Christian Brauner; +Cc: llvm, oe-kbuild-all, Christian Brauner
tree: https://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs.git work.mnt_idmap.statmount
head: e44d6d871d9cf676fadd6b5cb4c68ff3c6f2fc24
commit: 32ed618ba0faa39f735b4ef89fef1542d49a207f [4/5] samples/vfs: add STATMOUNT_MNT_{G,U}IDMAP
config: i386-buildonly-randconfig-001-20250131 (https://download.01.org/0day-ci/archive/20250131/202501310452.wltposNc-lkp@intel.com/config)
compiler: clang version 19.1.3 (https://github.com/llvm/llvm-project ab51eccf88f5321e7c60591c5546b254b6afab99)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250131/202501310452.wltposNc-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202501310452.wltposNc-lkp@intel.com/
All warnings (new ones prefixed by >>):
>> 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
2 warnings generated.
vim +152 samples/vfs/test-list-all-mounts.c
70
71 int main(int argc, char *argv[])
72 {
73 #define LISTMNT_BUFFER 10
74 __u64 list[LISTMNT_BUFFER], last_mnt_id = 0;
75 int ret, pidfd, fd_mntns;
76 struct mnt_ns_info info = {};
77
78 pidfd = sys_pidfd_open(getpid(), 0);
79 if (pidfd < 0)
80 die_errno("pidfd_open failed");
81
82 fd_mntns = ioctl(pidfd, PIDFD_GET_MNT_NAMESPACE, 0);
83 if (fd_mntns < 0)
84 die_errno("ioctl(PIDFD_GET_MNT_NAMESPACE) failed");
85
86 ret = ioctl(fd_mntns, NS_MNT_GET_INFO, &info);
87 if (ret < 0)
88 die_errno("ioctl(NS_GET_MNTNS_ID) failed");
89
90 printf("Listing %u mounts for mount namespace %" PRIu64 "\n",
91 info.nr_mounts, (uint64_t)info.mnt_ns_id);
92 for (;;) {
93 ssize_t nr_mounts;
94 next:
95 nr_mounts = sys_listmount(LSMT_ROOT, last_mnt_id,
96 info.mnt_ns_id, list, LISTMNT_BUFFER,
97 0);
98 if (nr_mounts <= 0) {
99 int fd_mntns_next;
100
101 printf("Finished listing %u mounts for mount namespace %" PRIu64 "\n\n",
102 info.nr_mounts, (uint64_t)info.mnt_ns_id);
103 fd_mntns_next = ioctl(fd_mntns, NS_MNT_GET_NEXT, &info);
104 if (fd_mntns_next < 0) {
105 if (errno == ENOENT) {
106 printf("Finished listing all mount namespaces\n");
107 exit(0);
108 }
109 die_errno("ioctl(NS_MNT_GET_NEXT) failed");
110 }
111 close(fd_mntns);
112 fd_mntns = fd_mntns_next;
113 last_mnt_id = 0;
114 printf("Listing %u mounts for mount namespace %" PRIu64 "\n",
115 info.nr_mounts, (uint64_t)info.mnt_ns_id);
116 goto next;
117 }
118
119 for (size_t cur = 0; cur < nr_mounts; cur++) {
120 struct statmount *stmnt;
121
122 last_mnt_id = list[cur];
123
124 stmnt = sys_statmount(last_mnt_id, info.mnt_ns_id,
125 STATMOUNT_SB_BASIC |
126 STATMOUNT_MNT_BASIC |
127 STATMOUNT_MNT_ROOT |
128 STATMOUNT_MNT_POINT |
129 STATMOUNT_MNT_NS_ID |
130 STATMOUNT_MNT_OPTS |
131 STATMOUNT_FS_TYPE |
132 STATMOUNT_MNT_UIDMAP |
133 STATMOUNT_MNT_GIDMAP, 0);
134 if (!stmnt) {
135 printf("Failed to statmount(%" PRIu64 ") in mount namespace(%" PRIu64 ")\n",
136 (uint64_t)last_mnt_id, (uint64_t)info.mnt_ns_id);
137 continue;
138 }
139
140 printf("mnt_id:\t\t%" PRIu64 "\nmnt_parent_id:\t%" PRIu64 "\nfs_type:\t%s\nmnt_root:\t%s\nmnt_point:\t%s\nmnt_opts:\t%s\n",
141 (uint64_t)stmnt->mnt_id,
142 (uint64_t)stmnt->mnt_parent_id,
143 (stmnt->mask & STATMOUNT_FS_TYPE) ? stmnt->str + stmnt->fs_type : "",
144 (stmnt->mask & STATMOUNT_MNT_ROOT) ? stmnt->str + stmnt->mnt_root : "",
145 (stmnt->mask & STATMOUNT_MNT_POINT) ? stmnt->str + stmnt->mnt_point : "",
146 (stmnt->mask & STATMOUNT_MNT_OPTS) ? stmnt->str + stmnt->mnt_opts : "");
147
148 if (stmnt->mask & STATMOUNT_MNT_UIDMAP) {
149 const char *idmap = stmnt->str + stmnt->mnt_uidmap;
150
151 for (size_t idx = 0; idx < stmnt->mnt_uidmap_num; idx++) {
> 152 printf("mnt_uidmap[%lu]:\t%s\n", idx, idmap);
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2025-01-30 21:09 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-01-30 21:09 [brauner-vfs:work.mnt_idmap.statmount 4/5] 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') kernel test robot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox