diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2021-05-17 02:19:06 +0200 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2021-05-19 02:15:58 +0200 |
commit | cf4febc1adc8e5cd11ca3386e1e3ea356e0792f0 (patch) | |
tree | df81ed4874e590f2f1fc1dd94c098c7a424ca925 /fs/d_path.c | |
parent | d_path: prepend_path(): lift the inner loop into a new helper (diff) | |
download | linux-cf4febc1adc8e5cd11ca3386e1e3ea356e0792f0.tar.xz linux-cf4febc1adc8e5cd11ca3386e1e3ea356e0792f0.zip |
d_path: prepend_path() is unlikely to return non-zero
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/d_path.c')
-rw-r--r-- | fs/d_path.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/fs/d_path.c b/fs/d_path.c index ba629879a4bf..8a9cd44f6689 100644 --- a/fs/d_path.c +++ b/fs/d_path.c @@ -187,7 +187,7 @@ char *__d_path(const struct path *path, DECLARE_BUFFER(b, buf, buflen); prepend(&b, "", 1); - if (prepend_path(path, root, &b) > 0) + if (unlikely(prepend_path(path, root, &b) > 0)) return NULL; return extract_string(&b); } @@ -199,7 +199,7 @@ char *d_absolute_path(const struct path *path, DECLARE_BUFFER(b, buf, buflen); prepend(&b, "", 1); - if (prepend_path(path, &root, &b) > 1) + if (unlikely(prepend_path(path, &root, &b) > 1)) return ERR_PTR(-EINVAL); return extract_string(&b); } @@ -396,7 +396,7 @@ SYSCALL_DEFINE2(getcwd, char __user *, buf, unsigned long, size) DECLARE_BUFFER(b, page, PATH_MAX); prepend(&b, "", 1); - if (prepend_path(&pwd, &root, &b) > 0) + if (unlikely(prepend_path(&pwd, &root, &b) > 0)) prepend(&b, "(unreachable)", 13); rcu_read_unlock(); |