* [PATCH] xattr: simplify logic at xattr_resolve_name()
@ 2021-04-09 17:48 Andriy Tkachuk
0 siblings, 0 replies; only message in thread
From: Andriy Tkachuk @ 2021-04-09 17:48 UTC (permalink / raw)
To: Alexander Viro
Cc: Andreas Gruenbacher, Andriy Tkachuk, linux-fsdevel, linux-kernel
The negative case check logic with XOR operation between the
two variables with negated values is really hard to comprehend.
Change it to positive case check with == instead of XOR.
Signed-off-by: Andriy Tkachuk <andriy.tkachuk@seagate.com>
---
fs/xattr.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/fs/xattr.c b/fs/xattr.c
index b3444e06cd..531562535d 100644
--- a/fs/xattr.c
+++ b/fs/xattr.c
@@ -66,13 +66,13 @@ xattr_resolve_name(struct inode *inode, const char **name)
n = strcmp_prefix(*name, xattr_prefix(handler));
if (n) {
- if (!handler->prefix ^ !*n) {
- if (*n)
- continue;
- return ERR_PTR(-EINVAL);
+ if (!handler->prefix == !*n) {
+ *name = n;
+ return handler;
}
- *name = n;
- return handler;
+ if (*n)
+ continue;
+ return ERR_PTR(-EINVAL);
}
}
return ERR_PTR(-EOPNOTSUPP);
--
2.27.0
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2021-04-09 17:49 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-09 17:48 [PATCH] xattr: simplify logic at xattr_resolve_name() Andriy Tkachuk
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®