]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
selftests/mm: fix -Wmaybe-uninitialized warnings
authorKevin Brodsky <kevin.brodsky@arm.com>
Mon, 9 Dec 2024 09:50:07 +0000 (09:50 +0000)
committerAndrew Morton <akpm@linux-foundation.org>
Tue, 14 Jan 2025 06:40:53 +0000 (22:40 -0800)
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@arm.com
Signed-off-by: Kevin Brodsky <kevin.brodsky@arm.com>
Cc: Aruna Ramakrishna <aruna.ramakrishna@oracle.com>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Dave Hansen <dave.hansen@linux.intel.com>
Cc: Joey Gouly <joey.gouly@arm.com>
Cc: Keith Lucas <keith.lucas@oracle.com>
Cc: Ryan Roberts <ryan.roberts@arm.com>
Cc: Shuah Khan <shuah@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
tools/testing/selftests/mm/ksm_tests.c
tools/testing/selftests/mm/mremap_test.c
tools/testing/selftests/mm/soft-dirty.c
tools/testing/selftests/mm/uffd-unit-tests.c

index b748c48908d9d4af9ba31fe7d2443329c13c3dc2..dcdd5bb20f3d8c9bb00a8362ced323b2acbe18fb 100644 (file)
@@ -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;
index d207a52f2b5beefc15ba8b36c1f93570ae0de06a..bb84476a177f16bbd3aa9b0979571770f9c0f47d 100644 (file)
@@ -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;
index bdfa5d085f0099f74a698c0f8c8170aa77565d28..8e1462ce0532657d4502518d653815ef53861890 100644 (file)
@@ -128,7 +128,7 @@ static void test_mprotect(int pagemap_fd, int pagesize, bool anon)
 {
        const char *type[] = {"file", "anon"};
        const char *fname = "./soft-dirty-test-file";
-       int test_fd;
+       int test_fd = 0;
        char *map;
 
        if (anon) {
index 74c884713bf7c50eb669fee811527eecb212d052..9ff71fa1f9bf09b3ae599250663a25bbe2c13b8a 100644 (file)
@@ -1122,7 +1122,7 @@ uffd_move_test_common(uffd_test_args_t *targs, unsigned long chunk_size,
        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;