X-Git-Url: https://git.openpandora.org/cgi-bin/gitweb.cgi?p=pandora-kernel.git;a=blobdiff_plain;f=fs%2Fbinfmt_misc.c;h=b53c7e5f41bbcffd8f936642117ecfce5f258a21;hp=18657f001b43ba8b1393da95cb7b0481910ba937;hb=ef3f2de2b5496f721b12f21a157e19eac816394b;hpb=02a93208edec0d655c9f18613d830dc6afeda7d4 diff --git a/fs/binfmt_misc.c b/fs/binfmt_misc.c index 18657f001b43..b53c7e5f41bb 100644 --- a/fs/binfmt_misc.c +++ b/fs/binfmt_misc.c @@ -1,7 +1,7 @@ /* * binfmt_misc.c * - * Copyright (C) 1997 Richard Günther + * Copyright (C) 1997 Richard Günther * * binfmt_misc detects binaries via a magic or filename extension and invokes * a specified wrapper. This should obsolete binfmt_java, binfmt_em86 and @@ -18,7 +18,7 @@ #include #include - +#include #include #include #include @@ -126,7 +126,9 @@ static int load_misc_binary(struct linux_binprm *bprm, struct pt_regs *regs) goto _ret; if (!(fmt->flags & MISC_FMT_PRESERVE_ARGV0)) { - remove_arg_zero(bprm); + retval = remove_arg_zero(bprm); + if (retval) + goto _ret; } if (fmt->flags & MISC_FMT_OPEN_BINARY) { @@ -675,19 +677,8 @@ static ssize_t bm_status_read(struct file *file, char __user *buf, size_t nbytes, loff_t *ppos) { char *s = enabled ? "enabled" : "disabled"; - int len = strlen(s); - loff_t pos = *ppos; - if (pos < 0) - return -EINVAL; - if (pos >= len) - return 0; - if (len < pos + nbytes) - nbytes = len - pos; - if (copy_to_user(buf, s + pos, nbytes)) - return -EFAULT; - *ppos = pos + nbytes; - return nbytes; + return simple_read_from_buffer(buf, nbytes, ppos, s, strlen(s)); } static ssize_t bm_status_write(struct file * file, const char __user * buffer,