diff options
author | Dan Carpenter <dan.carpenter@oracle.com> | 2022-07-19 12:42:48 +0300 |
---|---|---|
committer | akpm <akpm@linux-foundation.org> | 2022-07-30 04:07:16 +0300 |
commit | 3d5367a0426da61c7cb616cc85b6239467e261dd (patch) | |
tree | 0787e99e4719bffc94979eb3eef59350a78e47b6 /tools/testing | |
parent | 6d97cf88ddde9c976d04b886b10b464ec8006c85 (diff) | |
download | linux-3d5367a0426da61c7cb616cc85b6239467e261dd.tar.xz |
tools/testing/selftests/vm/hugetlb-madvise.c: silence uninitialized variable warning
This code just reads from memory without caring about the data itself.
However static checkers complain that "tmp" is never properly initialized.
Initialize it to zero and change the name to "dummy" to show that we
don't care about the value stored in it.
Link: https://lkml.kernel.org/r/YtZ8mKJmktA2GaHB@kili
Fixes: c4b6cb884011 ("selftests/vm: add hugetlb madvise MADV_DONTNEED MADV_REMOVE test")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Souptick Joarder (HPE) <jrdr.linux@gmail.com>
Reviewed-by: Mike Kravetz <mike.kravetz@oracle.com>
Cc: Shuah Khan <shuah@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Diffstat (limited to 'tools/testing')
-rw-r--r-- | tools/testing/selftests/vm/hugetlb-madvise.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/tools/testing/selftests/vm/hugetlb-madvise.c b/tools/testing/selftests/vm/hugetlb-madvise.c index 6c6af40f5747..3c9943131881 100644 --- a/tools/testing/selftests/vm/hugetlb-madvise.c +++ b/tools/testing/selftests/vm/hugetlb-madvise.c @@ -89,10 +89,11 @@ void write_fault_pages(void *addr, unsigned long nr_pages) void read_fault_pages(void *addr, unsigned long nr_pages) { - unsigned long i, tmp; + unsigned long dummy = 0; + unsigned long i; for (i = 0; i < nr_pages; i++) - tmp += *((unsigned long *)(addr + (i * huge_page_size))); + dummy += *((unsigned long *)(addr + (i * huge_page_size))); } int main(int argc, char **argv) |