From: Jaegeuk Kim via Linux-f2fs-devel <linux-f2fs-devel@lists.sourceforge.net>
To: linux-f2fs-devel@lists.sourceforge.net
Cc: Jaegeuk Kim <jaegeuk@kernel.org>
Subject: [f2fs-dev] [PATCH] f2fs_io: fix length for setxattr
Date: Thu, 9 Apr 2026 13:46:49 +0000 [thread overview]
Message-ID: <20260409134649.3693469-1-jaegeuk@kernel.org> (raw)
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
---
tools/f2fs_io/f2fs_io.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/tools/f2fs_io/f2fs_io.c b/tools/f2fs_io/f2fs_io.c
index c5f1da3e6313..680c06218394 100644
--- a/tools/f2fs_io/f2fs_io.c
+++ b/tools/f2fs_io/f2fs_io.c
@@ -2081,7 +2081,7 @@ static void do_listxattr(int argc, char **argv, const struct cmd_desc *cmd)
static void do_setxattr(int argc, char **argv, const struct cmd_desc *cmd)
{
- int ret;
+ int ret, len;
char *value;
unsigned char tmp;
@@ -2094,15 +2094,17 @@ static void do_setxattr(int argc, char **argv, const struct cmd_desc *cmd)
if (!strcmp(argv[1], F2FS_SYSTEM_ADVISE_NAME)) {
tmp = strtoul(argv[2], NULL, 0);
value = (char *)&tmp;
+ len = 1;
} else {
value = argv[2];
+ len = strlen(value);
}
- ret = setxattr(argv[3], argv[1], value, strlen(argv[2]), XATTR_CREATE);
+ ret = setxattr(argv[3], argv[1], value, len, XATTR_CREATE);
printf("setxattr %s CREATE: name: %s, value: %s: ret=%d\n",
argv[3], argv[1], argv[2], ret);
if (ret < 0 && errno == EEXIST) {
- ret = setxattr(argv[3], argv[1], value, strlen(argv[2]), XATTR_REPLACE);
+ ret = setxattr(argv[3], argv[1], value, len, XATTR_REPLACE);
printf("setxattr %s REPLACE: name: %s, value: %s: ret=%d\n",
argv[3], argv[1], argv[2], ret);
}
--
2.53.0.1213.gd9a14994de-goog
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
next reply other threads:[~2026-04-09 13:47 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-09 13:46 Jaegeuk Kim via Linux-f2fs-devel [this message]
2026-05-01 13:59 ` [f2fs-dev] [PATCH] f2fs_io: fix length for setxattr Daeho Jeong
2026-05-03 8:50 ` Chao Yu via Linux-f2fs-devel
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=20260409134649.3693469-1-jaegeuk@kernel.org \
--to=linux-f2fs-devel@lists.sourceforge.net \
--cc=jaegeuk@kernel.org \
/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.