[Devel] [PATCH vz10 00/15] selftests: fix compilation warnings across multiple tests
Konstantin Khorenko
khorenko at virtuozzo.com
Mon Mar 23 23:31:19 MSK 2026
Fix all GCC compilation warnings produced during kernel selftests build
(rpmbuild with -j48, GCC with -Wall).
The warnings fall into several categories:
- Unused variables (-Wunused-variable, -Wunused-but-set-variable):
remove or annotate unused variables in clone3, damon, epoll,
membarrier, memfd/fuse_test, mqueue, netfilter, and prctl tests.
- Possibly uninitialized (-Wmaybe-uninitialized):
initialize variables where GCC cannot statically prove they are
always assigned before use (cgroup/test_numa_migrate,
uevent/uevent_filtering). In memfd/memfd_test, replace malloc()
with calloc() since pwrite() is declared with attribute
'access(read_only, 2, 3)' and GCC warns about reading from
uninitialized heap memory.
- Strict aliasing (-Wstrict-aliasing):
suppress in breakpoints/breakpoint_test where type-punned reads
are intentional -- the test needs sized memory accesses at specific
addresses to trigger hardware breakpoints.
- Array bounds (-Warray-bounds):
suppress in iommu/iommufd_utils where the test intentionally
passes an undersized buffer to exercise the kernel's bounds
checking.
No functional changes.
https://virtuozzo.atlassian.net/browse/VSTOR-127529
Konstantin Khorenko (15):
selftests/cgroup: fix -Wmaybe-uninitialized warning in
test_numa_migrate
selftests/clone3: remove unused variables in
clone3_cap_checkpoint_restore
selftests/damon: fix -Wunused-but-set-variable in
huge_count_read_write
selftests/epoll: remove unused variable 'pfd' in epoll59 test
selftests/iommu: suppress -Warray-bounds in _test_cmd_get_hw_info
selftests/membarrier: remove unused variable 'i'
selftests/memfd: remove unused variable 'sig' in fuse_test
selftests/memfd: fix -Wmaybe-uninitialized warning in memfd_test
selftests/mqueue: fix -Wunused-variable warning for 'usage' in
mq_open_tests
selftests/mqueue: fix warnings in mq_perf_tests
selftests/netfilter: remove unused variable 'plen' in
conntrack_reverse_clash
selftests/netfilter: remove unused variables in conntrack_dump_flush
selftests/prctl: remove unused variable 'j' in set-process-name
selftests/uevent: fix -Wmaybe-uninitialized warning in
uevent_filtering
selftests/breakpoints: fix compilation warnings in breakpoint_test
.../selftests/breakpoints/breakpoint_test.c | 14 ++++++++++----
tools/testing/selftests/cgroup/test_numa_migrate.c | 1 +
.../clone3/clone3_cap_checkpoint_restore.c | 4 ----
.../selftests/damon/huge_count_read_write.c | 3 +--
.../filesystems/epoll/epoll_wakeup_test.c | 1 -
tools/testing/selftests/iommu/iommufd_utils.h | 7 +++++++
.../membarrier/membarrier_test_multi_thread.c | 1 -
tools/testing/selftests/memfd/fuse_test.c | 2 +-
tools/testing/selftests/memfd/memfd_test.c | 2 +-
tools/testing/selftests/mqueue/mq_open_tests.c | 2 +-
tools/testing/selftests/mqueue/mq_perf_tests.c | 4 +---
.../selftests/net/netfilter/conntrack_dump_flush.c | 7 ++-----
.../net/netfilter/conntrack_reverse_clash.c | 1 -
tools/testing/selftests/prctl/set-process-name.c | 3 +--
tools/testing/selftests/uevent/uevent_filtering.c | 2 +-
15 files changed, 27 insertions(+), 27 deletions(-)
--
2.47.1
More information about the Devel
mailing list