Skip to content

Commit e57b602

Browse files
committed
selftests/memfd/memfd_test: fix possible NULL pointer dereference
JIRA: https://issues.redhat.com/browse/RHEL-94834 commit 73519de Author: liuye <liuye@kylinos.cn> Date: Tue Jan 14 11:21:15 2025 +0800 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>" Signed-off-by: Joel Savitz <jsavitz@redhat.com>
1 parent 64c58bb commit e57b602

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
@@ -170,7 +170,7 @@ static void mfd_fail_new(const char *name, unsigned int flags)
170170
r = sys_memfd_create(name, flags);
171171
if (r >= 0) {
172172
printf("memfd_create(\"%s\", %u) succeeded, but failure expected\n",
173-
name, flags);
173+
name ? name : "NULL", flags);
174174
close(r);
175175
abort();
176176
}

0 commit comments

Comments
 (0)