public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Dongsu Park <dpark@posteo.net>
Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org,
	Peter Hurley <peter@hurleysoftware.com>,
	Josh Triplett <josh@joshtriplett.org>,
	Al Viro <viro@zeniv.linux.org.uk>,
	David Howells <dhowells@redhat.com>,
	Alban Crequy <alban@endocode.com>,
	Alexey Dobriyan <adobriyan@gmail.com>
Subject: Re: [PATCH v2] devpts: allow mounting with uid/gid of uint32_t
Date: Wed, 19 Aug 2015 00:47:14 -0700	[thread overview]
Message-ID: <20150819004714.c06e4a70.akpm@linux-foundation.org> (raw)
In-Reply-To: <20150819072431.GA2642@posteo.de>

On Wed, 19 Aug 2015 09:24:31 +0200 Dongsu Park <dpark@posteo.net> wrote:

> > 	unsigned long uidl;
> > 
> > 	rc = kstrtoul(uidstr, 0, &uidl);
> > 	uidval = uidl;
> 
> That's a good point. I'll do it.
> 
> > > +			if (rc)
> > >  				return -EINVAL;
> > 
> > I don't get it.  From my reading, kstrtouint->parse_integer() returns
> > "number of characters parsed or -E".  So this code won't work.  But
> > presumably it *does* work, so why?
> 
> It's probably because kstrtouint() returns just 0 on success.
> That's what functions in the call chain of kstrtouint() -> kstrtoull() ->
> _kstrtoull() -> _parse_integer() are actually doing.
> _parse_integer() actually returns rv, i.e. number of characters parsed.
> But after that, if there's no error, _kstrtoull() simply returns 0.

whoa, wait, I was looking at the -mm tree which changes kstrtouint():

static inline int __must_check kstrtouint(const char *s, unsigned int base, unsigned int *res)
{
	return parse_integer(s, base | PARSE_INTEGER_NEWLINE, res);
}

and

 * Return number of characters parsed or -E.
 ...
 */
#define parse_integer(s, base, val)	\



Alexey, doesn't this mean that code which does

	if (kstrtouint(...))
		return -EFOO;

will break?  Is it intended that parse_integer-convert-*.patch will fix
every callsite in the kernel?  If so, how do we know there haven't been
concurrent additions in -next which need review/conversion?  Let alone
out-of-tree things...

  reply	other threads:[~2015-08-19  7:47 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-18 14:31 [PATCH] devpts: allow mounting with uid/gid of uint32_t Dongsu Park
2015-08-18 15:18 ` [PATCH v2] " Dongsu Park
2015-08-18 23:44   ` Andrew Morton
2015-08-19  7:24     ` Dongsu Park
2015-08-19  7:47       ` Andrew Morton [this message]
2015-08-19  8:34         ` Rasmus Villemoes
2015-08-19 10:47         ` Alexey Dobriyan
2015-08-28 19:33   ` Peter Hurley
2015-08-29 10:43     ` Dongsu Park
2015-08-29 21:44       ` Alexey Dobriyan

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=20150819004714.c06e4a70.akpm@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=adobriyan@gmail.com \
    --cc=alban@endocode.com \
    --cc=dhowells@redhat.com \
    --cc=dpark@posteo.net \
    --cc=josh@joshtriplett.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=peter@hurleysoftware.com \
    --cc=viro@zeniv.linux.org.uk \
    /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