lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <AANLkTimNsDxeyZL4GVaH4L7YGO-EoRyCMHDtMPWU37hN@mail.gmail.com>
Date:	Wed, 15 Sep 2010 08:11:16 -0700
From:	Linus Torvalds <torvalds@...ux-foundation.org>
To:	Christopher Yeoh <cyeoh@....ibm.com>
Cc:	linux-kernel@...r.kernel.org
Subject: Re: [RFC][PATCH] Cross Memory Attach

On Tue, Sep 14, 2010 at 6:18 PM, Christopher Yeoh <cyeoh@....ibm.com> wrote:
> +
> +               if (copy_to) {
> +                       ret = copy_from_user(target_kaddr,
> +                                            user_buf + *bytes_copied,
> +                                            bytes_to_copy);
> +                       if (ret) {
> +                               kunmap(process_pages[i]);
> +                               goto end;
> +                       }
> +               } else {
> +                       ret = copy_to_user(user_buf + *bytes_copied,
> +                                          target_kaddr, bytes_to_copy);
> +                       if (ret) {
> +                               kunmap(process_pages[i]);
> +                               goto end;
> +                       }
> +               }
> +               kunmap(process_pages[i]);

Btw, please just do this as

   if (copy_to)
      ret = copy_from_user(..);
   else
      ret = copy_to_user(..);
   kunmap(process_pages[i]);
   if (ret)
      goto out;

(and also, I think you should probably use a real variable for
*bytes_copied, rather than update things behind the pointer. Update
the pointer just once at the end instead, or preferably just change
the calling convention to just return the number of bytes copied, and
let the caller do the page counting).

                      Linus
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ