Skip to content

Commit 9286857

Browse files
Anshuman Khandualakpm00
authored andcommitted
selftests/mm: fix compiler -Wmaybe-uninitialized warning
Following build warning comes up for cow test as 'transferred' variable has not been initialized. Fix the warning via zero init for the variable. CC cow cow.c: In function `do_test_vmsplice_in_parent': cow.c:365:61: warning: `transferred' may be used uninitialized [-Wmaybe-uninitialized] 365 | cur = read(fds[0], new + total, transferred - total); | ~~~~~~~~~~~~^~~~~~~ cow.c:296:29: note: `transferred' was declared here 296 | ssize_t cur, total, transferred; | ^~~~~~~~~~~ CC compaction_test CC gup_longterm Link: https://lkml.kernel.org/r/20250409095006.1422620-1-anshuman.khandual@arm.com Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com> Cc: Shuah Khan <shuah@kernel.org> Cc: Anshuman Khandual <anshuman.khandual@arm.com> Cc: David Hildenbrand <david@redhat.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
1 parent e6e07b6 commit 9286857

File tree

1 file changed

+1
-1
lines changed
  • tools/testing/selftests/mm

1 file changed

+1
-1
lines changed

tools/testing/selftests/mm/cow.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ static void do_test_vmsplice_in_parent(char *mem, size_t size,
293293
.iov_base = mem,
294294
.iov_len = size,
295295
};
296-
ssize_t cur, total, transferred;
296+
ssize_t cur, total, transferred = 0;
297297
struct comm_pipes comm_pipes;
298298
char *old, *new;
299299
int ret, fds[2];

0 commit comments

Comments
 (0)