[PATCH] fs: binfmt_em86: check return code of remove_arg_zero

From: Nick Desaulniers
Date: Tue Dec 22 2020 - 16:04:50 EST


remove_arg_zero is declared as __must_check. Looks like it can return
-EFAULT on failure.

Cc: Masahiro Yamada <masahiroy@xxxxxxxxxx>
Cc: Miguel Ojeda <miguel.ojeda.sandonis@xxxxxxxxx>
Reported-by: Guenter Roeck <linux@xxxxxxxxxxxx>
Signed-off-by: Nick Desaulniers <ndesaulniers@xxxxxxxxxx>
---
fs/binfmt_em86.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/fs/binfmt_em86.c b/fs/binfmt_em86.c
index 06b9b9fddf70..6e98fcfca66e 100644
--- a/fs/binfmt_em86.c
+++ b/fs/binfmt_em86.c
@@ -63,7 +63,8 @@ static int load_em86(struct linux_binprm *bprm)
* This is done in reverse order, because of how the
* user environment and arguments are stored.
*/
- remove_arg_zero(bprm);
+ retval = remove_arg_zero(bprm);
+ if (retval < 0) return retval;
retval = copy_string_kernel(bprm->filename, bprm);
if (retval < 0) return retval;
bprm->argc++;
--
2.29.2.729.g45daf8777d-goog