diff options
author | Mateusz Guzik <mjguzik@gmail.com> | 2025-03-20 10:23:31 +0100 |
---|---|---|
committer | Christian Brauner <brauner@kernel.org> | 2025-03-20 10:41:59 +0100 |
commit | d5a05a5a44a983ead5c57673af2c5bcfd2f0d3e9 (patch) | |
tree | d5421b54e454c11d7c2ae79e8ba442fa60dcc708 | |
parent | 9ae7e5a1cd17b271e1b3339a23883d3d64724dcc (diff) | |
download | linux-d5a05a5a44a983ead5c57673af2c5bcfd2f0d3e9.tar.gz linux-d5a05a5a44a983ead5c57673af2c5bcfd2f0d3e9.tar.bz2 linux-d5a05a5a44a983ead5c57673af2c5bcfd2f0d3e9.zip |
fs: tidy up do_sys_openat2() with likely/unlikely
Otherwise gcc 13 generates conditional forward jumps (aka branch
mispredict by default) for build_open_flags() being succesfull.
Signed-off-by: Mateusz Guzik <mjguzik@gmail.com>
Link: https://lore.kernel.org/r/20250320092331.1921700-1-mjguzik@gmail.com
Signed-off-by: Christian Brauner <brauner@kernel.org>
-rw-r--r-- | fs/open.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/fs/open.c b/fs/open.c index 634fdca6501a..df140788077b 100644 --- a/fs/open.c +++ b/fs/open.c @@ -1412,18 +1412,19 @@ static int do_sys_openat2(int dfd, const char __user *filename, struct open_how *how) { struct open_flags op; - int fd = build_open_flags(how, &op); struct filename *tmp; + int err, fd; - if (fd) - return fd; + err = build_open_flags(how, &op); + if (unlikely(err)) + return err; tmp = getname(filename); if (IS_ERR(tmp)) return PTR_ERR(tmp); fd = get_unused_fd_flags(how->flags); - if (fd >= 0) { + if (likely(fd >= 0)) { struct file *f = do_filp_open(dfd, tmp, &op); if (IS_ERR(f)) { put_unused_fd(fd); |