Skip to content

Commit 725d502

Browse files
committed
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 <[email protected]> Signed-off-by: Kees Cook <[email protected]> --- Cc: Eric Biederman <[email protected]> Cc: Alexander Viro <[email protected]> Cc: Christian Brauner <[email protected]> Cc: Jan Kara <[email protected]> Cc: [email protected] Cc: [email protected]
1 parent 1710742 commit 725d502

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

fs/exec.c

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1720,7 +1720,6 @@ static int prepare_binprm(struct linux_binprm *bprm)
17201720
*/
17211721
int remove_arg_zero(struct linux_binprm *bprm)
17221722
{
1723-
int ret = 0;
17241723
unsigned long offset;
17251724
char *kaddr;
17261725
struct page *page;
@@ -1731,10 +1730,8 @@ int remove_arg_zero(struct linux_binprm *bprm)
17311730
do {
17321731
offset = bprm->p & ~PAGE_MASK;
17331732
page = get_arg_page(bprm, bprm->p, 0);
1734-
if (!page) {
1735-
ret = -EFAULT;
1736-
goto out;
1737-
}
1733+
if (!page)
1734+
return -EFAULT;
17381735
kaddr = kmap_local_page(page);
17391736

17401737
for (; offset < PAGE_SIZE && kaddr[offset];
@@ -1748,8 +1745,7 @@ int remove_arg_zero(struct linux_binprm *bprm)
17481745
bprm->p++;
17491746
bprm->argc--;
17501747

1751-
out:
1752-
return ret;
1748+
return 0;
17531749
}
17541750
EXPORT_SYMBOL(remove_arg_zero);
17551751

0 commit comments

Comments
 (0)