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/[email protected] Signed-off-by: liuye <[email protected]> Reviewed-by: Lorenzo Stoakes <[email protected]> Cc: Greg Thelen <[email protected]> Cc: "Isaac J. Manjarres" <[email protected]> Cc: Jeff Xu <[email protected]> Cc: Saurav Shah <[email protected]> Cc: Shuah Khan (Samsung OSG) <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
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)