[LTP] Avoid syscall param ioctl(generic) points to uninitialised byte(s)
Cyril Hrubis
chrubis@suse.cz
Wed Apr 15 12:18:20 CEST 2026
Hi!
> From b81924101f441d7f2103197c8b81a38e8920fda4 Mon Sep 17 00:00:00 2001
> From: Super User <root@vm-10-0-185-15.hosted.upshift.rdu2.redhat.com>
> Date: Wed, 20 Jan 2038 01:08:34 -0500
> Subject: [PATCH] Avoid syscall param ioctl(generic) points to uninitialised
> byte(s)
>
> lib/tst_clocks.c: fix uninitialized memory in run() Reproducible
> using userfaultfd01.
This description does not seem to correspond to the actual change.
> Signed-off-by: Martin Cermak <mcermak@redhat.com>
> ---
> testcases/kernel/syscalls/userfaultfd/userfaultfd01.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/testcases/kernel/syscalls/userfaultfd/userfaultfd01.c b/testcases/kernel/syscalls/userfaultfd/userfaultfd01.c
> index 7368d3863..d24766e7c 100644
> --- a/testcases/kernel/syscalls/userfaultfd/userfaultfd01.c
> +++ b/testcases/kernel/syscalls/userfaultfd/userfaultfd01.c
> @@ -92,8 +92,8 @@ static void *handle_thread(void)
> static void run(unsigned int i)
> {
> pthread_t thr;
> - struct uffdio_api uffdio_api = {};
> - struct uffdio_register uffdio_register;
> + struct uffdio_api uffdio_api = {0, };
> + struct uffdio_register uffdio_register = {0, };
Given that we were using = {}; in the code before can we keep using that
and for all instances?
Also I assume the problem is the ioctls field in the uffdio_api
structure that is not initialized beacuse is supposed to be set by
kernel before returning into userspace. Should valgrind warn about such
cases?
--
Cyril Hrubis
chrubis@suse.cz
More information about the ltp
mailing list