diff options
author | Kees Cook <keescook@chromium.org> | 2024-03-09 13:46:30 -0800 |
---|---|---|
committer | Kees Cook <keescook@chromium.org> | 2024-03-09 13:46:30 -0800 |
commit | 725d50261285ccf02501f2a1a6d10b31ce014597 (patch) | |
tree | 454b8f75fb5f4c29eec8e693f878563c9f1270f2 /fs/exec.c | |
parent | 17107429947b5d8a15f6dcef15c287eeade97258 (diff) |
exec: Simplify remove_arg_zero() error path
We don't need the "out" label any more, so remove "ret" and return
directly on error.
Reviewed-by: Jan Kara <jack@suse.cz>
Signed-off-by: Kees Cook <keescook@chromium.org>
---
Cc: Eric Biederman <ebiederm@xmission.com>
Cc: Alexander Viro <viro@zeniv.linux.org.uk>
Cc: Christian Brauner <brauner@kernel.org>
Cc: Jan Kara <jack@suse.cz>
Cc: linux-mm@kvack.org
Cc: linux-fsdevel@vger.kernel.org
Diffstat (limited to 'fs/exec.c')
-rw-r--r-- | fs/exec.c | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/fs/exec.c b/fs/exec.c index 715e1a8aa4f0..e7d9d6ad980b 100644 --- a/fs/exec.c +++ b/fs/exec.c @@ -1720,7 +1720,6 @@ static int prepare_binprm(struct linux_binprm *bprm) */ int remove_arg_zero(struct linux_binprm *bprm) { - int ret = 0; unsigned long offset; char *kaddr; struct page *page; @@ -1731,10 +1730,8 @@ int remove_arg_zero(struct linux_binprm *bprm) do { offset = bprm->p & ~PAGE_MASK; page = get_arg_page(bprm, bprm->p, 0); - if (!page) { - ret = -EFAULT; - goto out; - } + if (!page) + return -EFAULT; kaddr = kmap_local_page(page); for (; offset < PAGE_SIZE && kaddr[offset]; @@ -1748,8 +1745,7 @@ int remove_arg_zero(struct linux_binprm *bprm) bprm->p++; bprm->argc--; -out: - return ret; + return 0; } EXPORT_SYMBOL(remove_arg_zero); |