Skip to content

Commit 73519de

Browse files
qiyeliuakpm00
authored andcommitted
selftests/memfd/memfd_test: fix possible NULL pointer dereference
If `name' is NULL, a NULL pointer may be accessed in printf. Link: https://lkml.kernel.org/r/20250114032115.58638-1-liuye@kylinos.cn Signed-off-by: liuye <liuye@kylinos.cn> Reviewed-by: Lorenzo Stoakes <lorenzo.stoakes@oracle.com> Cc: Greg Thelen <gthelen@google.com> Cc: "Isaac J. Manjarres" <isaacmanjarres@google.com> Cc: Jeff Xu <jeffxu@google.com> Cc: Saurav Shah <sauravshah.31@gmail.com> Cc: Shuah Khan (Samsung OSG) <shuah@kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
1 parent d94d23f commit 73519de

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

tools/testing/selftests/memfd/memfd_test.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ static void mfd_fail_new(const char *name, unsigned int flags)
171171
r = sys_memfd_create(name, flags);
172172
if (r >= 0) {
173173
printf("memfd_create(\"%s\", %u) succeeded, but failure expected\n",
174-
name, flags);
174+
name ? name : "NULL", flags);
175175
close(r);
176176
abort();
177177
}

0 commit comments

Comments
 (0)