From: Andriy Tkachuk <andriy.tkachuk@gmail.com>
To: Alexander Viro <viro@zeniv.linux.org.uk>
Cc: Andreas Gruenbacher <agruenba@redhat.com>,
Andriy Tkachuk <andriy.tkachuk@seagate.com>,
linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] xattr: simplify logic at xattr_resolve_name()
Date: Fri, 9 Apr 2021 18:48:36 +0100 [thread overview]
Message-ID: <20210409174836.23694-1-andriy.tkachuk@seagate.com> (raw)
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
reply other threads:[~2021-04-09 17:49 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20210409174836.23694-1-andriy.tkachuk@seagate.com \
--to=andriy.tkachuk@gmail.com \
--cc=agruenba@redhat.com \
--cc=andriy.tkachuk@seagate.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=viro@zeniv.linux.org.uk \
/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 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®