* [LTP] [PATCH 1/2] nfs01_open_files: Fix st_size check
@ 2022-03-22 9:47 Petr Vorel
2022-03-22 9:47 ` [LTP] [PATCH 2/2] nfs01_open_files: Add SPDX, copyright Petr Vorel
2022-03-22 15:32 ` [LTP] [PATCH 1/2] nfs01_open_files: Fix st_size check Cyril Hrubis
0 siblings, 2 replies; 5+ messages in thread
From: Petr Vorel @ 2022-03-22 9:47 UTC (permalink / raw)
To: ltp
94c85d93e8 didn't update struct stat st_size check, but the problem was
hidden until dc836ec4cd (before code was not run).
Fixes: 94c85d93e8 ("nfs01: fix string overrrun")
Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
testcases/network/nfs/nfs_stress/nfs01_open_files.c | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/testcases/network/nfs/nfs_stress/nfs01_open_files.c b/testcases/network/nfs/nfs_stress/nfs01_open_files.c
index cc6a84d685..0a4732859e 100644
--- a/testcases/network/nfs/nfs_stress/nfs01_open_files.c
+++ b/testcases/network/nfs/nfs_stress/nfs01_open_files.c
@@ -13,6 +13,8 @@
#define TEMPLATE_PREFIX "ltp"
#define TEMPLATE_PREFIX_LEN (sizeof(TEMPLATE_PREFIX) - 1)
#define TEMPLATE TEMPLATE_PREFIX "XXXXXX"
+#define MSG "I Love Linux!!!\n"
+#define MSG_LEN (sizeof(MSG) - 1)
int write_something(int);
void delete_files(void);
@@ -84,7 +86,7 @@ int main(int argc, char *argv[])
int write_something(int fd)
{
int rc;
- const char msg[] = "I Love Linux!!!\n";
+ const char msg[] = MSG;
int msg_len = strlen(msg);
rc = write(fd, msg, msg_len);
@@ -107,9 +109,11 @@ void delete_files(void)
if (stat(entp->d_name, &stat_buffer))
abortx("stat() failed for \"%s\", errno = %d",
entp->d_name, errno);
- if (stat_buffer.st_size != 23)
- abortx("wrong file size for \"%s\"",
- entp->d_name);
+
+ if (stat_buffer.st_size != MSG_LEN)
+ abortx("wrong file size for \"%s\": %d",
+ entp->d_name, stat_buffer.st_size);
+
if (unlink(entp->d_name))
abortx("unlink failed for \"%s\"",
entp->d_name);
--
2.35.1
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply related [flat|nested] 5+ messages in thread* [LTP] [PATCH 2/2] nfs01_open_files: Add SPDX, copyright 2022-03-22 9:47 [LTP] [PATCH 1/2] nfs01_open_files: Fix st_size check Petr Vorel @ 2022-03-22 9:47 ` Petr Vorel 2022-03-22 15:33 ` Cyril Hrubis 2022-03-22 15:32 ` [LTP] [PATCH 1/2] nfs01_open_files: Fix st_size check Cyril Hrubis 1 sibling, 1 reply; 5+ messages in thread From: Petr Vorel @ 2022-03-22 9:47 UTC (permalink / raw) To: ltp Signed-off-by: Petr Vorel <pvorel@suse.cz> --- testcases/network/nfs/nfs_stress/nfs01_open_files.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/testcases/network/nfs/nfs_stress/nfs01_open_files.c b/testcases/network/nfs/nfs_stress/nfs01_open_files.c index 0a4732859e..678d7a9ecf 100644 --- a/testcases/network/nfs/nfs_stress/nfs01_open_files.c +++ b/testcases/network/nfs/nfs_stress/nfs01_open_files.c @@ -1,3 +1,8 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Copyright (c) Linux Test Project, 2001-2022 + */ + #include <stdio.h> #include <errno.h> #include <stdarg.h> -- 2.35.1 -- Mailing list info: https://lists.linux.it/listinfo/ltp ^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [LTP] [PATCH 2/2] nfs01_open_files: Add SPDX, copyright 2022-03-22 9:47 ` [LTP] [PATCH 2/2] nfs01_open_files: Add SPDX, copyright Petr Vorel @ 2022-03-22 15:33 ` Cyril Hrubis 0 siblings, 0 replies; 5+ messages in thread From: Cyril Hrubis @ 2022-03-22 15:33 UTC (permalink / raw) To: Petr Vorel; +Cc: ltp Hi! Looks reasonable. Reviewed-by: Cyril Hrubis <chrubis@suse.cz> -- Cyril Hrubis chrubis@suse.cz -- Mailing list info: https://lists.linux.it/listinfo/ltp ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [LTP] [PATCH 1/2] nfs01_open_files: Fix st_size check 2022-03-22 9:47 [LTP] [PATCH 1/2] nfs01_open_files: Fix st_size check Petr Vorel 2022-03-22 9:47 ` [LTP] [PATCH 2/2] nfs01_open_files: Add SPDX, copyright Petr Vorel @ 2022-03-22 15:32 ` Cyril Hrubis 2022-03-22 16:03 ` Petr Vorel 1 sibling, 1 reply; 5+ messages in thread From: Cyril Hrubis @ 2022-03-22 15:32 UTC (permalink / raw) To: Petr Vorel; +Cc: ltp Hi! Looks good. Reviewed-by: Cyril Hrubis <chrubis@suse.cz> -- Cyril Hrubis chrubis@suse.cz -- Mailing list info: https://lists.linux.it/listinfo/ltp ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [LTP] [PATCH 1/2] nfs01_open_files: Fix st_size check 2022-03-22 15:32 ` [LTP] [PATCH 1/2] nfs01_open_files: Fix st_size check Cyril Hrubis @ 2022-03-22 16:03 ` Petr Vorel 0 siblings, 0 replies; 5+ messages in thread From: Petr Vorel @ 2022-03-22 16:03 UTC (permalink / raw) To: Cyril Hrubis; +Cc: ltp Hi Cyril, > Hi! > Looks good. Thx, patchset merged. Kind regards, Petr -- Mailing list info: https://lists.linux.it/listinfo/ltp ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2022-03-22 16:03 UTC | newest] Thread overview: 5+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2022-03-22 9:47 [LTP] [PATCH 1/2] nfs01_open_files: Fix st_size check Petr Vorel 2022-03-22 9:47 ` [LTP] [PATCH 2/2] nfs01_open_files: Add SPDX, copyright Petr Vorel 2022-03-22 15:33 ` Cyril Hrubis 2022-03-22 15:32 ` [LTP] [PATCH 1/2] nfs01_open_files: Fix st_size check Cyril Hrubis 2022-03-22 16:03 ` Petr Vorel
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.