]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
[Patch] fs/binfmt_elf.c: fix wrong return values
authorWANG Cong <xiyou.wangcong@gmail.com>
Thu, 8 May 2008 13:52:33 +0000 (21:52 +0800)
committerAl Viro <viro@zeniv.linux.org.uk>
Fri, 16 May 2008 21:23:11 +0000 (17:23 -0400)
create_elf_tables() returns 0 on success. But when strnlen_user() "fails",
it returns 0 directly. So this is wrong.

Signed-off-by: WANG Cong <wangcong@zeuux.org>
Cc: Alexander Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
fs/binfmt_elf.c

index bd08332079cf89b460d5e62314760af704c7b8f8..0fa95b198e6e9c89f5f4166b45666bdf6171c730 100644 (file)
@@ -256,7 +256,7 @@ create_elf_tables(struct linux_binprm *bprm, struct elfhdr *exec,
                        return -EFAULT;
                len = strnlen_user((void __user *)p, MAX_ARG_STRLEN);
                if (!len || len > MAX_ARG_STRLEN)
-                       return 0;
+                       return -EINVAL;
                p += len;
        }
        if (__put_user(0, argv))
@@ -268,7 +268,7 @@ create_elf_tables(struct linux_binprm *bprm, struct elfhdr *exec,
                        return -EFAULT;
                len = strnlen_user((void __user *)p, MAX_ARG_STRLEN);
                if (!len || len > MAX_ARG_STRLEN)
-                       return 0;
+                       return -EINVAL;
                p += len;
        }
        if (__put_user(0, envp))