linux-mips.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
To: Christoph Hellwig <hch@lst.de>
Cc: linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 3/4] MIPS: uaccess: Remove get_fs/set_fs call sites
Date: Thu, 1 Apr 2021 14:51:00 +0200	[thread overview]
Message-ID: <20210401125100.GA9556@alpha.franken.de> (raw)
In-Reply-To: <20210401063055.GB25514@lst.de>

On Thu, Apr 01, 2021 at 08:30:55AM +0200, Christoph Hellwig wrote:
> On Wed, Mar 31, 2021 at 01:56:00PM +0200, Thomas Bogendoerfer wrote:
> > +#define __get_user_nofault(dst, src, type, err_label)			\
> > +do {									\
> > +	int __gu_err;							\
> > +									\
> > +	__get_user_common(*((type *)(dst)), sizeof(type),		\
> > +			  (__force type *)(src));			\
> > +	if (unlikely(__gu_err))						\
> > +		goto err_label;						\
> > +} while (0)
> > +
> > +
> > +static inline int __get_addr(unsigned long *a, unsigned long *p, bool user)
> > +{
> > +	if (user)
> > +		__get_user_nofault(a, p, unsigned long, fault);
> > +	else
> > +		__get_kernel_nofault(a, p, unsigned long, fault);
> > +
> > +	return 0;
> > +
> > +fault:
> > +	return -EFAULT;
> > +}
> 
> Why can't these use plain old get_user and get_kernel_nofault?
> You "optimize" away the access_ok / get_kernel_nofaul_allowed checks
> here, but now use totally non-standard and possibly dangerous APIs.

thanks, I was too deep into the macro wormhole... using standard API
makes this even look nicer. Posting v3 in a few minutes.

Thomas.

-- 
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a
good idea.                                                [ RFC1925, 2.3 ]

  reply	other threads:[~2021-04-01 18:03 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-31 11:55 [PATCH v2 0/4] MIPS: Remove get_fs/set_fs Thomas Bogendoerfer
2021-03-31 11:55 ` [PATCH v2 1/4] MIPS: kernel: Remove not needed set_fs calls Thomas Bogendoerfer
2021-04-01  6:22   ` Christoph Hellwig
2021-03-31 11:55 ` [PATCH v2 2/4] MIPS: uaccess: Added __get/__put_kernel_nofault Thomas Bogendoerfer
2021-04-01  6:27   ` Christoph Hellwig
2021-03-31 11:56 ` [PATCH v2 3/4] MIPS: uaccess: Remove get_fs/set_fs call sites Thomas Bogendoerfer
2021-04-01  6:30   ` Christoph Hellwig
2021-04-01 12:51     ` Thomas Bogendoerfer [this message]
2021-03-31 11:56 ` [PATCH v2 4/4] MIPS: Remove get_fs/set_fs Thomas Bogendoerfer

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=20210401125100.GA9556@alpha.franken.de \
    --to=tsbogend@alpha.franken.de \
    --cc=hch@lst.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mips@vger.kernel.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).