linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Al Viro <viro@ZenIV.linux.org.uk>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Michael Ellerman <mpe@ellerman.id.au>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	linux-fsdevel <linux-fsdevel@vger.kernel.org>,
	"linuxppc-dev@lists.ozlabs.org" <linuxppc-dev@lists.ozlabs.org>
Subject: Re: [git pull] vfs.git part 1
Date: Fri, 7 Jul 2017 19:59:55 +0100	[thread overview]
Message-ID: <20170707185955.GH10672@ZenIV.linux.org.uk> (raw)
In-Reply-To: <CA+55aFzHBR9M+UN2CMAQ0np275iyWyAY0uKK8LFo33g0e7Z-VQ@mail.gmail.com>

On Fri, Jul 07, 2017 at 10:35:41AM -0700, Linus Torvalds wrote:

> Comments? Michael, does this work for your case?

Looks sane...

> +++ b/fs/fcntl.c
> @@ -520,50 +520,50 @@ SYSCALL_DEFINE3(fcntl64, unsigned int, fd, unsigned int, cmd,
>  
>  #ifdef CONFIG_COMPAT
>  /* careful - don't use anywhere else */
> -#define copy_flock_fields(from, to)		\
> -	(to).l_type = (from).l_type;		\
> -	(to).l_whence = (from).l_whence;	\
> -	(to).l_start = (from).l_start;		\
> -	(to).l_len = (from).l_len;		\
> -	(to).l_pid = (from).l_pid;
> -
> -static int get_compat_flock(struct flock *kfl, struct compat_flock __user *ufl)
> +#define copy_flock_fields(dst, src)		\
> +	(dst)->l_type = (src)->l_type;		\
> +	(dst)->l_whence = (src)->l_whence;	\
> +	(dst)->l_start = (src)->l_start;	\
> +	(dst)->l_len = (src)->l_len;		\
> +	(dst)->l_pid = (src)->l_pid;
> +
> +static int get_compat_flock(struct flock *kfl, const struct compat_flock __user *ufl)
>  {
>  	struct compat_flock fl;
>  
>  	if (copy_from_user(&fl, ufl, sizeof(struct compat_flock)))
>  		return -EFAULT;
> -	copy_flock_fields(*kfl, fl);
> +	copy_flock_fields(kfl, &fl);
>  	return 0;
>  }
>  
> -static int get_compat_flock64(struct flock *kfl, struct compat_flock64 __user *ufl)
> +static int get_compat_flock64(struct flock *kfl, const struct compat_flock64 __user *ufl)
>  {
>  	struct compat_flock64 fl;
>  
>  	if (copy_from_user(&fl, ufl, sizeof(struct compat_flock64)))
>  		return -EFAULT;
> -	copy_flock_fields(*kfl, fl);
> +	copy_flock_fields(kfl, &fl);
>  	return 0;
>  }
>  
> -static int put_compat_flock(struct flock *kfl, struct compat_flock __user *ufl)
> +static int put_compat_flock(const struct flock *kfl, struct compat_flock __user *ufl)
>  {
>  	struct compat_flock fl;
>  
>  	memset(&fl, 0, sizeof(struct compat_flock));
> -	copy_flock_fields(fl, *kfl);
> +	copy_flock_fields(&fl, kfl);
>  	if (copy_to_user(ufl, &fl, sizeof(struct compat_flock)))
>  		return -EFAULT;
>  	return 0;
>  }
>  
> -static int put_compat_flock64(struct flock *kfl, struct compat_flock64 __user *ufl)
> +static int put_compat_flock64(const struct flock *kfl, struct compat_flock64 __user *ufl)
>  {
>  	struct compat_flock64 fl;
>  
>  	memset(&fl, 0, sizeof(struct compat_flock64));
> -	copy_flock_fields(fl, *kfl);
> +	copy_flock_fields(&fl, kfl);
>  	if (copy_to_user(ufl, &fl, sizeof(struct compat_flock64)))
>  		return -EFAULT;
>  	return 0;

  reply	other threads:[~2017-07-07 20:02 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20170705071423.GY10672@ZenIV.linux.org.uk>
2017-07-07 12:46 ` [git pull] vfs.git part 1 Michael Ellerman
2017-07-07 15:59   ` Linus Torvalds
2017-07-07 16:30     ` Linus Torvalds
2017-07-07 22:55       ` Michael Ellerman
2017-07-07 17:35     ` Linus Torvalds
2017-07-07 18:59       ` Al Viro [this message]
2017-07-07 22:50       ` Michael Ellerman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170707185955.GH10672@ZenIV.linux.org.uk \
    --to=viro@zeniv.linux.org.uk \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=mpe@ellerman.id.au \
    --cc=torvalds@linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).