aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYAO, Xin <mr.yaoxin@outlook.com>2026-07-01 20:10:13 +0000
committerPouria Mousavizadeh Tehrani <pouria@FreeBSD.org>2026-07-02 11:17:01 +0000
commit8ad097de02263d92df3368a2f5035faa365e7956 (patch)
treeb66f4d52d7323024d9898c2ae179937d0345e196
parentfbc039e512c3bb1635ad20cc8f70ad608ea818b7 (diff)
linuxulator: Fix operator precedence for LINUX_XATTR_FLAGS in setxattr()
The LINUX_XATTR_FLAGS macro expands to (LINUX_XATTR_CREATE|LINUX_XATTR_REPLACE). Without parentheses around the macro expansion, the bitwise & operator has higher precedence than |, causing incorrect flag evaluation and a compiler warning. Add the missing parentheses around LINUX_XATTR_FLAGS to ensure correct operator grouping, matching the existing usage in getxattr(). Signed-off-by: YAO, Xin <mr.yaoxin@outlook.com> Fixes: 2c905456312b ("linuxulator: Fix O_PATH file descriptors errno for f*xattr(2)") Reviewed by: kib Pull Request: https://github.com/freebsd/freebsd-src/pull/2306
-rw-r--r--sys/compat/linux/linux_xattr.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/sys/compat/linux/linux_xattr.c b/sys/compat/linux/linux_xattr.c
index 296b70ff409a..9a206089ada1 100644
--- a/sys/compat/linux/linux_xattr.c
+++ b/sys/compat/linux/linux_xattr.c
@@ -53,7 +53,7 @@
#define LINUX_XATTR_CREATE 0x1
#define LINUX_XATTR_REPLACE 0x2
-#define LINUX_XATTR_FLAGS LINUX_XATTR_CREATE|LINUX_XATTR_REPLACE
+#define LINUX_XATTR_FLAGS (LINUX_XATTR_CREATE | LINUX_XATTR_REPLACE)
struct listxattr_args {
int fd;
@@ -511,8 +511,8 @@ setxattr(struct thread *td, struct setxattr_args *args)
return (error);
}
- if ((args->flags & ~(LINUX_XATTR_FLAGS)) != 0 ||
- args->flags == (LINUX_XATTR_FLAGS)) {
+ if ((args->flags & ~LINUX_XATTR_FLAGS) != 0 ||
+ args->flags == LINUX_XATTR_FLAGS) {
error = EINVAL;
goto out_err;
}
@@ -520,7 +520,7 @@ setxattr(struct thread *td, struct setxattr_args *args)
if (error != 0)
goto out_err;
- if ((args->flags & (LINUX_XATTR_FLAGS)) != 0 ) {
+ if ((args->flags & LINUX_XATTR_FLAGS) != 0) {
if (args->path != NULL)
error = kern_extattr_get_path(td, args->path,
attrnamespace, attrname, NULL, args->size,