From: Andrea Cervesato via ltp <ltp@lists.linux.it>
To: "Jinseok Kim" <always.starving0@gmail.com>, <ltp@lists.linux.it>
Subject: Re: [LTP] [PATCH v2 1/2] open: fix cleanup condition and use snprintf
Date: Thu, 19 Feb 2026 10:37:34 +0100 [thread overview]
Message-ID: <DGIU5TUBY8DA.1O11NEVRMZTZK@suse.com> (raw)
In-Reply-To: <20260218144747.2771-1-always.starving0@gmail.com>
Hi!
On Wed Feb 18, 2026 at 3:47 PM CET, Jinseok Kim wrote:
> Replace remaining sprintf() with snprintf() in setup()
>
> Thanks for the review.
Again, there's something wrong with your automated system. Is it LLM? :-)
The message is misleading, also because not only snprintf() touched, but
also cleanup() logic.
This has to be fixed, otherwise patch can't be accepted.
>
> Signed-off-by: Jinseok Kim <always.starving0@gmail.com>
> ---
> testcases/kernel/syscalls/open/open04.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/testcases/kernel/syscalls/open/open04.c b/testcases/kernel/syscalls/open/open04.c
> index 3dc3486d3..5d39c1569 100644
> --- a/testcases/kernel/syscalls/open/open04.c
> +++ b/testcases/kernel/syscalls/open/open04.c
> @@ -30,7 +30,7 @@ static void setup(void)
> fds[0] = first;
>
> for (i = first + 1; i < fds_limit; i++) {
> - sprintf(fname, FNAME ".%d", i);
> + snprintf(fname, sizeof(fname), FNAME ".%d", i);
> fd = open(fname, O_RDWR | O_CREAT, 0777);
> if (fd == -1) {
> if (errno != EMFILE)
> @@ -44,13 +44,13 @@ static void setup(void)
>
> static void run(void)
> {
> - sprintf(fname, FNAME ".%d", fds_limit);
> + snprintf(fname, sizeof(fname), FNAME ".%d", fds_limit);
> TST_EXP_FAIL2(open(fname, O_RDWR | O_CREAT, 0777), EMFILE);
> }
>
> static void cleanup(void)
> {
> - if (!first || !fds)
> + if (first < 0 || !fds)
And this cleanup has an issue. See below..
> return;
>
> for (i = first; i < fds_limit; i++)
> --
> 2.43.0
This test has to work also for `-i 0` option. The way we can make it
works is the following:
- "first" should be initialized to -1, otherwise "first < 0" won't be
catched
- the fds should be initialized with -1 after SAFE_MALLOC(), otherwise
you will fail the cleanup if malloc will break the test
Kind Regards,
--
Andrea Cervesato
SUSE QE Automation Engineer Linux
andrea.cervesato@suse.com
--
Mailing list info: https://lists.linux.it/listinfo/ltp
next prev parent reply other threads:[~2026-02-19 9:38 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-18 14:47 [LTP] [PATCH v2 1/2] open: fix cleanup condition and use snprintf Jinseok Kim
2026-02-18 14:47 ` [LTP] [PATCH v2 2/2] open: replace getdtablesize with getrlimit Jinseok Kim
2026-02-19 9:37 ` Andrea Cervesato via ltp [this message]
2026-02-19 14:15 ` [LTP] [PATCH v3 1/2] open: fix cleanup condition and use snprintf Jinseok Kim
2026-02-19 14:15 ` [LTP] [PATCH v3 2/2] open: replace getdtablesize with getrlimit Jinseok Kim
2026-03-13 16:42 ` Petr Vorel
2026-03-20 13:56 ` [LTP] [PATCH v3 1/2] open: fix cleanup condition and use snprintf Andrea Cervesato via ltp
2026-03-21 14:08 ` [LTP] [PATCH v4] " Jinseok Kim
2026-03-23 6:45 ` Andrea Cervesato via ltp
2026-03-25 12:22 ` [LTP] [PATCH v5] " Jinseok Kim
2026-03-25 15:48 ` Andrea Cervesato via ltp
2026-03-27 14:03 ` [LTP] [PATCH v6] " Jinseok Kim
2026-03-27 14:52 ` Andrea Cervesato via ltp
2026-04-09 8:19 ` Andrea Cervesato via ltp
-- strict thread matches above, loose matches on Subject: below --
2026-02-17 11:40 [LTP] [PATCH 2/2] open: replace getdtablesize with getrlimit Andrea Cervesato via ltp
2026-02-17 12:22 ` [LTP] [PATCH v2 1/2] open: fix cleanup condition and use snprintf Jinseok Kim
2026-02-18 12:34 ` Andrea Cervesato via ltp
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=DGIU5TUBY8DA.1O11NEVRMZTZK@suse.com \
--to=ltp@lists.linux.it \
--cc=always.starving0@gmail.com \
--cc=andrea.cervesato@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox