All of lore.kernel.org
 help / color / mirror / Atom feed
From: Cyril Hrubis <chrubis@suse.cz>
To: ltp@lists.linux.it
Cc: Richard Palethorpe <rpalethorpe@suse.com>
Subject: [LTP] [PATCH] syscalls/statvfs01: Correcly zero terminate the strings
Date: Wed, 18 Jan 2023 14:36:43 +0100	[thread overview]
Message-ID: <20230118133643.11371-1-chrubis@suse.cz> (raw)

Fixes random failures caused by the fact that the stack is not
guaranteed to be zeroed.

Fixes: e305ac4a305f ("statvfs01: Convert to new LTP API")
Signed-off-by: Cyril Hrubis <chrubis@suse.cz>
CC: Petr Vorel <pvorel@suse.cz>
CC: Richard Palethorpe <rpalethorpe@suse.com>
CC: Avinesh Kumar <akumar@suse.de>
---
 testcases/kernel/syscalls/statvfs/statvfs01.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/testcases/kernel/syscalls/statvfs/statvfs01.c b/testcases/kernel/syscalls/statvfs/statvfs01.c
index dd14d6a0e..f17dc4cfa 100644
--- a/testcases/kernel/syscalls/statvfs/statvfs01.c
+++ b/testcases/kernel/syscalls/statvfs/statvfs01.c
@@ -38,6 +38,9 @@ static void run(void)
 	memset(valid_fname, 'a', valid_len);
 	memset(toolong_fname, 'b', valid_len + 1);
 
+	valid_fname[valid_len] = 0;
+	toolong_fname[valid_len+1] = 0;
+
 	TST_EXP_FD(creat(valid_fname, 0444));
 	SAFE_CLOSE(TST_RET);
 
-- 
2.38.2


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

             reply	other threads:[~2023-01-18 13:35 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-18 13:36 Cyril Hrubis [this message]
2023-01-18 16:40 ` [LTP] [PATCH] syscalls/statvfs01: Correcly zero terminate the strings Petr Vorel
2023-01-18 17:01 ` Martin Doucha
2023-01-18 21:40   ` Petr Vorel
2023-01-19 14:41   ` Cyril Hrubis
2023-01-19 14:56     ` Martin Doucha

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=20230118133643.11371-1-chrubis@suse.cz \
    --to=chrubis@suse.cz \
    --cc=ltp@lists.linux.it \
    --cc=rpalethorpe@suse.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.