From: "Ricardo B. Marliere via ltp" <ltp@lists.linux.it>
To: "Sven Schnelle" <svens@linux.ibm.com>, <ltp@lists.linux.it>
Cc: ltp <ltp-bounces+ltp=archiver.kernel.org@lists.linux.it>
Subject: Re: [LTP] [PATCH] mmap01: initialize buffer in check_file()
Date: Wed, 22 Jan 2025 07:43:14 -0300 [thread overview]
Message-ID: <D78JG0F2FTVF.247MMHZD8G4GH@suse.com> (raw)
In-Reply-To: <20250122100915.3126008-1-svens@linux.ibm.com>
On Wed Jan 22, 2025 at 7:09 AM -03, Sven Schnelle wrote:
> mmap01 reported random test failures. Turns out the
> the temporary buffer in check_file() isn't initialized.
> The SAFE_READ reads less then sizeof(buf) bytes so the
> rest stays initialized and might contain bytes check_file()
> is looking for.
>
> Signed-off-by: Sven Schnelle <svens@linux.ibm.com>
Reviewed-by: Ricardo B. Marliere <rbm@suse.com>
> ---
> testcases/kernel/syscalls/mmap/mmap01.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/testcases/kernel/syscalls/mmap/mmap01.c b/testcases/kernel/syscalls/mmap/mmap01.c
> index c93c37ceda52..ff09bc635c74 100644
> --- a/testcases/kernel/syscalls/mmap/mmap01.c
> +++ b/testcases/kernel/syscalls/mmap/mmap01.c
> @@ -36,6 +36,7 @@ static void check_file(void)
> int i, fildes, buf_len = sizeof(STRING) + 3;
> char buf[buf_len];
>
> + memset(buf, 0, sizeof(buf));
> fildes = SAFE_OPEN(TEMPFILE, O_RDONLY);
> SAFE_READ(0, fildes, buf, sizeof(buf));
>
--
Mailing list info: https://lists.linux.it/listinfo/ltp
prev parent reply other threads:[~2025-01-22 10:43 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-22 10:09 [LTP] [PATCH] mmap01: initialize buffer in check_file() Sven Schnelle
2025-01-22 10:26 ` Petr Vorel
2025-01-22 11:01 ` Cyril Hrubis
2025-01-22 12:13 ` Sven Schnelle
2025-01-22 12:28 ` Cyril Hrubis
2025-01-22 12:33 ` Sven Schnelle
2025-01-22 10:43 ` Ricardo B. Marliere via ltp [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=D78JG0F2FTVF.247MMHZD8G4GH@suse.com \
--to=ltp@lists.linux.it \
--cc=ltp-bounces+ltp=archiver.kernel.org@lists.linux.it \
--cc=rbm@suse.com \
--cc=svens@linux.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox