summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2021-05-18 05:41:11 +0300
committerAl Viro <viro@zeniv.linux.org.uk>2021-05-19 03:08:12 +0300
commit95b55c42f65af3fb9e2dceaf4d8dde522c0472d3 (patch)
tree73745628a5f0508c8a1c826cdac471c58c468ae4
parent01a4428ee7068875995ee27e9ba5503874f23e3b (diff)
downloadlinux-95b55c42f65af3fb9e2dceaf4d8dde522c0472d3.tar.xz
d_path: make prepend_name() boolean
It returns only 0 or -ENAMETOOLONG and both callers only check if the result is negative. Might as well return true on success and false on failure... Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
-rw-r--r--fs/d_path.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/fs/d_path.c b/fs/d_path.c
index 327cc3744554..83db83446afd 100644
--- a/fs/d_path.c
+++ b/fs/d_path.c
@@ -34,15 +34,15 @@ static void prepend(char **buffer, int *buflen, const char *str, int namelen)
*
* Load acquire is needed to make sure that we see that terminating NUL.
*/
-static int prepend_name(char **buffer, int *buflen, const struct qstr *name)
+static bool prepend_name(char **buffer, int *buflen, const struct qstr *name)
{
const char *dname = smp_load_acquire(&name->name); /* ^^^ */
u32 dlen = READ_ONCE(name->len);
char *p;
*buflen -= dlen + 1;
- if (*buflen < 0)
- return -ENAMETOOLONG;
+ if (unlikely(*buflen < 0))
+ return false;
p = *buffer -= dlen + 1;
*p++ = '/';
while (dlen--) {
@@ -51,7 +51,7 @@ static int prepend_name(char **buffer, int *buflen, const struct qstr *name)
break;
*p++ = c;
}
- return 0;
+ return true;
}
/**
@@ -127,7 +127,7 @@ restart:
}
parent = dentry->d_parent;
prefetch(parent);
- if (unlikely(prepend_name(&bptr, &blen, &dentry->d_name) < 0))
+ if (!prepend_name(&bptr, &blen, &dentry->d_name))
break;
dentry = parent;
@@ -305,7 +305,7 @@ restart:
const struct dentry *parent = dentry->d_parent;
prefetch(parent);
- if (unlikely(prepend_name(&end, &len, &dentry->d_name) < 0))
+ if (!prepend_name(&end, &len, &dentry->d_name))
break;
dentry = parent;