Skip to content

Commit ebc4b1e

Browse files
committed
Merge: selftests/memfd/memfd_test: fix possible NULL pointer dereference
MR: https://gitlab.com/redhat/centos-stream/src/kernel/centos-stream-10/-/merge_requests/984 Fix undefined behavior by backporting the following upstream commit: ``` 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. ``` JIRA: https://issues.redhat.com/browse/RHEL-94834 Signed-off-by: Joel Savitz <jsavitz@redhat.com> Approved-by: Waiman Long <longman@redhat.com> Approved-by: Herton R. Krzesinski <herton@redhat.com> Approved-by: Rafael Aquini <raquini@redhat.com> Approved-by: CKI KWF Bot <cki-ci-bot+kwf-gitlab-com@redhat.com> Merged-by: Jan Stancek <jstancek@redhat.com>
2 parents 73bcbd6 + e57b602 commit ebc4b1e

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)