From: Ralf Baechle Two bugs in the MIPS version of kernel_execve(); the inline asm which was copying from _syscall3 macro was still using the #stringify operation, so isn't even valid C. It also didn't get the result return in case of errors right - $a3 = 1 indicates an error in which case $v0 will contain the positive error number. Signed-off-by: Ralf Baechle Cc: Arnd Bergmann Signed-off-by: Andrew Morton --- arch/mips/kernel/syscall.c | 19 ++++++++++++------- 1 files changed, 12 insertions(+), 7 deletions(-) diff -puN arch/mips/kernel/syscall.c~provide-kernel_execve-on-all-architectures-mips-fix arch/mips/kernel/syscall.c --- a/arch/mips/kernel/syscall.c~provide-kernel_execve-on-all-architectures-mips-fix +++ a/arch/mips/kernel/syscall.c @@ -416,15 +416,20 @@ int kernel_execve(const char *filename, register unsigned long __a2 asm("$6") = (unsigned long) envp; register unsigned long __a3 asm("$7"); unsigned long __v0; - __asm__ volatile ( - ".set\tnoreorder\n\t" - "li\t$2, %5\t\t\t# " #name "\n\t" - "syscall\n\t" - "move\t%0, $2\n\t" - ".set\treorder" + + __asm__ volatile (" \n" + " .set noreorder \n" + " li $2, %5 # __NR_execve \n" + " syscall \n" + " move %0, $2 \n" + " .set reorder \n" : "=&r" (__v0), "=r" (__a3) : "r" (__a0), "r" (__a1), "r" (__a2), "i" (__NR_execve) : "$2", "$8", "$9", "$10", "$11", "$12", "$13", "$14", "$15", "$24", "memory"); - return __v0; + + if (__a3 == 0) + return __v0; + + return -__v0; } _