The patch titled Subject: selftests/mm: fix -Wmaybe-uninitialized warnings has been added to the -mm mm-unstable branch. Its filename is selftests-mm-fix-wmaybe-uninitialized-warnings.patch This patch will shortly appear at https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/selftests-mm-fix-wmaybe-uninitialized-warnings.patch This patch will later appear in the mm-unstable branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next via the mm-everything branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm and is updated there every 2-3 working days ------------------------------------------------------ From: Kevin Brodsky <kevin.brodsky@xxxxxxx> Subject: selftests/mm: fix -Wmaybe-uninitialized warnings Date: Mon, 9 Dec 2024 09:50:07 +0000 A few -Wmaybe-uninitialized warnings show up when building the mm tests with -O2. None of them looks worrying; silence them by initialising the problematic variables. Link: https://lkml.kernel.org/r/20241209095019.1732120-3-kevin.brodsky@xxxxxxx Signed-off-by: Kevin Brodsky <kevin.brodsky@xxxxxxx> Cc: Aruna Ramakrishna <aruna.ramakrishna@xxxxxxxxxx> Cc: Catalin Marinas <catalin.marinas@xxxxxxx> Cc: Dave Hansen <dave.hansen@xxxxxxxxxxxxxxx> Cc: Joey Gouly <joey.gouly@xxxxxxx> Cc: Keith Lucas <keith.lucas@xxxxxxxxxx> Cc: Ryan Roberts <ryan.roberts@xxxxxxx> Cc: Shuah Khan <shuah@xxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- tools/testing/selftests/mm/ksm_tests.c | 2 +- tools/testing/selftests/mm/mremap_test.c | 2 +- tools/testing/selftests/mm/soft-dirty.c | 2 +- tools/testing/selftests/mm/uffd-unit-tests.c | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) --- a/tools/testing/selftests/mm/ksm_tests.c~selftests-mm-fix-wmaybe-uninitialized-warnings +++ a/tools/testing/selftests/mm/ksm_tests.c @@ -776,7 +776,7 @@ err_out: int main(int argc, char *argv[]) { - int ret, opt; + int ret = 0, opt; int prot = 0; int ksm_scan_limit_sec = KSM_SCAN_LIMIT_SEC_DEFAULT; int merge_type = KSM_MERGE_TYPE_DEFAULT; --- a/tools/testing/selftests/mm/mremap_test.c~selftests-mm-fix-wmaybe-uninitialized-warnings +++ a/tools/testing/selftests/mm/mremap_test.c @@ -384,7 +384,7 @@ out: static long long remap_region(struct config c, unsigned int threshold_mb, char *rand_addr) { - void *addr, *src_addr, *dest_addr, *dest_preamble_addr; + void *addr, *src_addr, *dest_addr, *dest_preamble_addr = NULL; unsigned long long t, d; struct timespec t_start = {0, 0}, t_end = {0, 0}; long long start_ns, end_ns, align_mask, ret, offset; --- a/tools/testing/selftests/mm/soft-dirty.c~selftests-mm-fix-wmaybe-uninitialized-warnings +++ a/tools/testing/selftests/mm/soft-dirty.c @@ -128,7 +128,7 @@ static void test_mprotect(int pagemap_fd { const char *type[] = {"file", "anon"}; const char *fname = "./soft-dirty-test-file"; - int test_fd; + int test_fd = 0; char *map; if (anon) { --- a/tools/testing/selftests/mm/uffd-unit-tests.c~selftests-mm-fix-wmaybe-uninitialized-warnings +++ a/tools/testing/selftests/mm/uffd-unit-tests.c @@ -1122,7 +1122,7 @@ uffd_move_test_common(uffd_test_args_t * char c; unsigned long long count; struct uffd_args args = { 0 }; - char *orig_area_src, *orig_area_dst; + char *orig_area_src = NULL, *orig_area_dst = NULL; unsigned long step_size, step_count; unsigned long src_offs = 0; unsigned long dst_offs = 0; _ Patches currently in -mm which might be from kevin.brodsky@xxxxxxx are selftests-mm-fix-condition-in-uffd_move_test_common.patch selftests-mm-fix-wmaybe-uninitialized-warnings.patch selftests-mm-fix-strncpy-length.patch selftests-mm-fix-warray-bounds-warnings-in-pkey_sighandler_tests.patch selftests-mm-build-with-o2.patch selftests-mm-remove-unused-pkey-helpers.patch selftests-mm-define-types-using-typedef-in-pkey-helpersh.patch selftests-mm-ensure-pkey-h-define-inline-functions-only.patch selftests-mm-remove-empty-pkey-helper-definition.patch selftests-mm-ensure-non-global-pkey-symbols-are-marked-static.patch selftests-mm-use-sys_pkey-helpers-consistently.patch selftests-mm-rename-pkey-register-macro.patch selftests-mm-skip-pkey_sighandler_tests-if-support-is-missing.patch selftests-mm-remove-x-permission-from-sigaltstack-mapping.patch