* [LTP] [PATCH v2] read_all: Fix buffer too small for long paths
@ 2026-09-07 12:03 Michael Menasherov via ltp
2026-09-07 14:58 ` [LTP] " linuxtestproject.agent
0 siblings, 1 reply; 4+ messages in thread
From: Michael Menasherov via ltp @ 2026-09-07 12:03 UTC (permalink / raw)
To: ltp
queue_pop() copies each path into popped[BUFFER_SIZE], but BUFFER_SIZE
was 1024 while visit_dir() builds paths up to MAX_PATH (4096). Any path
longer than 1023 bytes aborted the test with TBROK "Buffer is too small
for path".
Set BUFFER_SIZE and MAX_PATH to PATH_MAX so all path buffers and size
limits use the standard constant consistently.
Tested on smaller boards and then on local machines with deeply nested
directories under /sys; read_all_sys now passes instead of aborting.
Fixes: 67c95fbbfc3a ("Add read_all file systems test")
Signed-off-by: Michael Menasherov <mmenashe@redhat.com>
---
testcases/kernel/fs/read_all/read_all.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/testcases/kernel/fs/read_all/read_all.c b/testcases/kernel/fs/read_all/read_all.c
index 5720ffb99..bf5f613a3 100644
--- a/testcases/kernel/fs/read_all/read_all.c
+++ b/testcases/kernel/fs/read_all/read_all.c
@@ -51,8 +51,8 @@
#include "tst_timer.h"
#define QUEUE_SIZE 16384
-#define BUFFER_SIZE 1024
-#define MAX_PATH 4096
+#define BUFFER_SIZE PATH_MAX
+#define MAX_PATH PATH_MAX
#define MAX_DISPLAY 40
struct queue {
--
2.55.0
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [LTP] read_all: Fix buffer too small for long paths
2026-09-07 12:03 [LTP] [PATCH v2] read_all: Fix buffer too small for long paths Michael Menasherov via ltp
@ 2026-09-07 14:58 ` linuxtestproject.agent
0 siblings, 0 replies; 4+ messages in thread
From: linuxtestproject.agent @ 2026-09-07 14:58 UTC (permalink / raw)
To: Michael Menasherov; +Cc: ltp
Hi Michael,
On Sep 7, 2026, Michael Menasherov wrote:
> read_all: Fix buffer too small for long paths
> +#define BUFFER_SIZE PATH_MAX
With the existing `if (++j >= BUFFER_SIZE - 1)` check, this still rejects a
valid PATH_MAX - 1-character pathname and reports TBROK before writing its
terminating NUL. A 4095-byte pathname reproduces this on PATH_MAX=4096; change
the queue_pop() bound so PATH_MAX - 1 characters fit.
Verdict - Needs revision
---
Note:
The agent can sometimes produce false positives although often its
findings are genuine. If you find issues with the review, please
comment this email or ignore the suggestions.
Regards,
LTP AI Reviewer
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 4+ messages in thread
* [LTP] [PATCH v3] read_all: Fix buffer too small for long paths
@ 2026-09-08 9:22 Michael Menasherov via ltp
2026-09-08 10:42 ` [LTP] " linuxtestproject.agent
0 siblings, 1 reply; 4+ messages in thread
From: Michael Menasherov via ltp @ 2026-09-08 9:22 UTC (permalink / raw)
To: ltp
queue_pop() copies each path into popped[BUFFER_SIZE], but BUFFER_SIZE
was 1024 while visit_dir() builds paths up to PATH_MAX. Any path longer
than 1023 bytes aborted the test with TBROK.
Use PATH_MAX for BUFFER_SIZE and MAX_PATH, and drop the extra -1 from
the queue_pop() bound so a PATH_MAX - 1 character path fits.
Tested on smaller boards and then on local machines with deeply nested
directories under /sys.
Fixes: 67c95fbbfc3a ("Add read_all file systems test")
Signed-off-by: Michael Menasherov <mmenashe@redhat.com>
---
testcases/kernel/fs/read_all/read_all.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/testcases/kernel/fs/read_all/read_all.c b/testcases/kernel/fs/read_all/read_all.c
index 5720ffb99..ec9454fc9 100644
--- a/testcases/kernel/fs/read_all/read_all.c
+++ b/testcases/kernel/fs/read_all/read_all.c
@@ -51,8 +51,8 @@
#include "tst_timer.h"
#define QUEUE_SIZE 16384
-#define BUFFER_SIZE 1024
-#define MAX_PATH 4096
+#define BUFFER_SIZE PATH_MAX
+#define MAX_PATH PATH_MAX
#define MAX_DISPLAY 40
struct queue {
@@ -131,7 +131,7 @@ static int queue_pop(struct queue *q)
while (q->data[i]) {
q->popped[j] = q->data[i];
- if (++j >= BUFFER_SIZE - 1)
+ if (++j >= BUFFER_SIZE)
tst_brk(TBROK, "Buffer is too small for path");
i = (i + 1) % QUEUE_SIZE;
--
2.55.0
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply related [flat|nested] 4+ messages in thread* [LTP] [PATCH] read_all: Fix buffer too small for long paths
@ 2026-09-06 13:56 Michael Menasherov via ltp
2026-09-06 16:02 ` [LTP] " linuxtestproject.agent
0 siblings, 1 reply; 4+ messages in thread
From: Michael Menasherov via ltp @ 2026-09-06 13:56 UTC (permalink / raw)
To: ltp
queue_pop() copies each path into popped[BUFFER_SIZE], but BUFFER_SIZE
was 1024 while visit_dir() builds paths up to MAX_PATH (4096). Any path
longer than 1023 bytes aborted the test with TBROK "Buffer is too small
for path".
Set BUFFER_SIZE to 4096 to match MAX_PATH. QUEUE_SIZE (16384) still
holds a full-length path.
Tested on smaller boards and then on local machines with deeply nested
directories under /sys; read_all_sys now passes instead of aborting.
Fixes: 67c95fbbfc3a ("Add read_all file systems test")
Signed-off-by: Michael Menasherov <mmenashe@redhat.com>
---
testcases/kernel/fs/read_all/read_all.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/testcases/kernel/fs/read_all/read_all.c b/testcases/kernel/fs/read_all/read_all.c
index 5720ffb99..d67fe5712 100644
--- a/testcases/kernel/fs/read_all/read_all.c
+++ b/testcases/kernel/fs/read_all/read_all.c
@@ -51,7 +51,7 @@
#include "tst_timer.h"
#define QUEUE_SIZE 16384
-#define BUFFER_SIZE 1024
+#define BUFFER_SIZE 4096
#define MAX_PATH 4096
#define MAX_DISPLAY 40
--
2.55.0
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [LTP] read_all: Fix buffer too small for long paths
2026-09-06 13:56 [LTP] [PATCH] " Michael Menasherov via ltp
@ 2026-09-06 16:02 ` linuxtestproject.agent
0 siblings, 0 replies; 4+ messages in thread
From: linuxtestproject.agent @ 2026-09-06 16:02 UTC (permalink / raw)
To: Michael Menasherov; +Cc: ltp
Hi Michael,
On Sun, 06 Sep 2026 16:56:50 +0300, Michael Menasherov wrote:
> read_all: Fix buffer too small for long paths
> -#define BUFFER_SIZE 1024
> +#define BUFFER_SIZE 4096
queue_pop() still aborts for a 4095-byte pathname: after copying its final
byte, ++j is 4095, which satisfies BUFFER_SIZE - 1. Use PATH_MAX for popped
and compare j against PATH_MAX so every pathname that fits dent_path also
fits the queue buffer.
Verdict - Needs revision
Pre-existing issue:
read_all.c:218 has an unnecessary blank line before a closing brace, as
reported by make check.
---
Note:
The agent can sometimes produce false positives although often its
findings are genuine. If you find issues with the review, please
comment this email or ignore the suggestions.
Regards,
LTP AI Reviewer
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-09-08 10:43 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-07 12:03 [LTP] [PATCH v2] read_all: Fix buffer too small for long paths Michael Menasherov via ltp
2026-09-07 14:58 ` [LTP] " linuxtestproject.agent
-- strict thread matches above, loose matches on Subject: below --
2026-09-08 9:22 [LTP] [PATCH v3] " Michael Menasherov via ltp
2026-09-08 10:42 ` [LTP] " linuxtestproject.agent
2026-09-06 13:56 [LTP] [PATCH] " Michael Menasherov via ltp
2026-09-06 16:02 ` [LTP] " linuxtestproject.agent
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox