]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
selftests/mm/uffd: initialize char variable to Null
authorAnkit Khushwaha <ankitkhushwaha.linux@gmail.com>
Wed, 26 Nov 2025 16:08:30 +0000 (21:38 +0530)
committerAndrew Morton <akpm@linux-foundation.org>
Sat, 29 Nov 2025 18:41:09 +0000 (10:41 -0800)
commit0384c8ea96bfe49e82e624e53bfd5f80c3230ea9
treed66f4c9584cd3a655dbdba0acd7466e3aafd9edf
parentf65372cd7acbe3c4980d404e99a7017afed607b4
selftests/mm/uffd: initialize char variable to Null

In "uffd-stress.c" & "uffd-unit-tests.c". address of char variable having
garbage value (uninitialized) is passed to 'write' syscall triggers
warning.

uffd-stress.c:246:39: warning: variable 'c' is uninitialized when
passed  as a const pointer argument here
[-Wuninitialized-const-pointer]

uffd-unit-tests.c:581:31: warning: variable 'c' is uninitialized
when passed as a const pointer argument here
[-Wuninitialized-const-pointer]

so the fix is to assign char variable to '\0' to prevent writing of
garbage value.

Link: https://lkml.kernel.org/r/20251126160830.52124-1-ankitkhushwaha.linux@gmail.com
Signed-off-by: Ankit Khushwaha <ankitkhushwaha.linux@gmail.com>
Reviewed-by: Mike Rapoport (Microsoft) <rppt@kernel.org>
Cc: Bill Wendling <morbo@google.com>
Cc: Justin Stitt <justinstitt@google.com>
Cc: Liam Howlett <liam.howlett@oracle.com>
Cc: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Nathan Chancellor <nathan@kernel.org>
Cc: Peter Xu <peterx@redhat.com>
Cc: Shuah Khan <shuah@kernel.org>
Cc: Suren Baghdasaryan <surenb@google.com>
Cc: Vlastimil Babka <vbabka@suse.cz>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
tools/testing/selftests/mm/uffd-stress.c
tools/testing/selftests/mm/uffd-unit-tests.c