[LTP] [PATCH 1/3] syscalls/{, f}setxattr: Fix passing of value pointer

Kevin Brodsky
2023-10-23T14:19:17Z

tc[i].value is a pointer to the actual value pointer, it therefore
needs to be dereferenced before passing it down to {f,}setxattr()
(which is already done as expected in the TEST() line below).

This brokenness went unnoticed as the initial value (garbage before
this patch) is never read back - this call is only used to create
the key.

Signed-off-by: Kevin Brodsky <kevin.brodsky@arm.com>
---
testcases/kernel/syscalls/fsetxattr/fsetxattr01.c | 2 +-
testcases/kernel/syscalls/setxattr/setxattr01.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/testcases/kernel/syscalls/fsetxattr/fsetxattr01.c b/testcases/kernel/syscalls/fsetxattr/fsetxattr01.c
index d799e477f49c..b65b27bdf9ac 100644
--- a/testcases/kernel/syscalls/fsetxattr/fsetxattr01.c
+++ b/testcases/kernel/syscalls/fsetxattr/fsetxattr01.c
@@ -140,7 +140,7 @@ static void verify_fsetxattr(unsigned int i)
{
/* some tests might require existing keys for each iteration */
if (tc[i].keyneeded) {
- SAFE_FSETXATTR(fd, tc[i].key, tc[i].value, tc[i].size,
+ SAFE_FSETXATTR(fd, tc[i].key, *tc[i].value, tc[i].size,
XATTR_CREATE);
}

diff --git a/testcases/kernel/syscalls/setxattr/setxattr01.c b/testcases/kernel/syscalls/setxattr/setxattr01.c
index 8cd2821d0c6c..31f41369a608 100644
--- a/testcases/kernel/syscalls/setxattr/setxattr01.c
+++ b/testcases/kernel/syscalls/setxattr/setxattr01.c
@@ -137,7 +137,7 @@ static void verify_setxattr(unsigned int i)
{
/* some tests might require existing keys for each iteration */
if (tc[i].keyneeded) {
- SAFE_SETXATTR(FNAME, tc[i].key, tc[i].value, tc[i].size,
+ SAFE_SETXATTR(FNAME, tc[i].key, *tc[i].value, tc[i].size,
XATTR_CREATE);
}

--
2.38.1