mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-11-01 09:13:37 +00:00
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>
This commit is contained in:
parent
d94d23fdd7
commit
73519ded99
1 changed files with 1 additions and 1 deletions
|
|
@ -171,7 +171,7 @@ static void mfd_fail_new(const char *name, unsigned int flags)
|
|||
r = sys_memfd_create(name, flags);
|
||||
if (r >= 0) {
|
||||
printf("memfd_create(\"%s\", %u) succeeded, but failure expected\n",
|
||||
name, flags);
|
||||
name ? name : "NULL", flags);
|
||||
close(r);
|
||||
abort();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue