From: Andrea Cervesato via ltp <ltp@lists.linux.it>
To: "Wei Gao" <wegao@suse.com>
Cc: Jan Kara <jack@suse.cz>,
kernel test robot <oliver.sang@intel.com>,
ltp@lists.linux.it
Subject: Re: [LTP] [PATCH v5] fanotify22.c: handle multiple asynchronous error events
Date: Thu, 26 Mar 2026 09:40:48 +0000 [thread overview]
Message-ID: <69c4ff21.050a0220.3574c5.1d14@mx.google.com> (raw)
In-Reply-To: <20260326012908.6885-1-wegao@suse.com>
Hi Wei,
The overall approach with poll/read loop and consolidate_events() looks
good. A few issues below.
> + char *current_pos = event_buf + read_len;
> + int ret = read(fd_notify, current_pos, BUF_SIZE - read_len);
read() returns ssize_t, not int. Should be:
ssize_t ret = read(fd_notify, current_pos, BUF_SIZE - read_len);
Also, both read_len and BUF_SIZE are effectively unsigned here. If
read_len ever reaches or exceeds BUF_SIZE, the subtraction wraps to a
huge value and read() will write past event_buf. A defensive check
before the read would be safer:
if (read_len >= BUF_SIZE)
tst_brk(TBROK, "Event buffer full");
> + if (ret < 0) {
> + tst_res(TFAIL, "%s: read failed: %s", tcase->name, strerror(errno));
> + goto out;
> + }
Two things here:
1) Use TERRNO instead of manual strerror(errno):
tst_res(... | TERRNO, "%s: read failed", tcase->name);
2) A read() failure after poll() confirmed data availability is a test
infrastructure problem, not a test logic failure. This should be
TBROK, not TFAIL:
tst_brk(TBROK | TERRNO, "%s: read failed", tcase->name);
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-03-26 9:41 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-04 13:38 [LTP] [PATCH v1] fanotify22.c: handle multiple asynchronous error events Wei Gao via ltp
2026-03-05 9:36 ` Jan Kara
2026-03-05 14:36 ` Wei Gao via ltp
2026-03-05 15:50 ` Jan Kara
2026-03-06 4:50 ` Wei Gao via ltp
2026-03-06 12:24 ` Petr Vorel
2026-03-06 15:19 ` Jan Kara
2026-03-09 7:59 ` [LTP] [PATCH v2] " Wei Gao via ltp
2026-03-09 10:26 ` Andrea Cervesato via ltp
2026-03-09 11:29 ` Jan Kara
2026-03-18 6:46 ` [LTP] [PATCH v3] " Wei Gao via ltp
2026-03-18 18:18 ` Jan Kara
2026-03-24 11:55 ` Andrea Cervesato via ltp
2026-03-25 12:43 ` [LTP] [PATCH v4] " Wei Gao via ltp
2026-03-25 15:52 ` Jan Kara
2026-03-26 1:28 ` [LTP] [PATCH v5] " Wei Gao via ltp
2026-03-26 8:57 ` Jan Kara
2026-03-26 9:40 ` Andrea Cervesato via ltp [this message]
2026-03-27 4:55 ` [LTP] [PATCH v6] " Wei Gao via ltp
2026-03-27 9:07 ` Andrea Cervesato via ltp
2026-03-27 12:33 ` [LTP] [PATCH v7] " Wei Gao via ltp
2026-03-27 14:19 ` Andrea Cervesato via ltp
2026-03-28 0:44 ` Wei Gao via ltp
2026-03-30 7:17 ` Andrea Cervesato via ltp
2026-03-30 7:36 ` Jan Kara
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=69c4ff21.050a0220.3574c5.1d14@mx.google.com \
--to=ltp@lists.linux.it \
--cc=andrea.cervesato@suse.com \
--cc=jack@suse.cz \
--cc=oliver.sang@intel.com \
--cc=wegao@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