Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932065AbbHSHrB (ORCPT ); Wed, 19 Aug 2015 03:47:01 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:33532 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752813AbbHSHq6 (ORCPT ); Wed, 19 Aug 2015 03:46:58 -0400 Date: Wed, 19 Aug 2015 00:47:14 -0700 From: Andrew Morton To: Dongsu Park Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, Peter Hurley , Josh Triplett , Al Viro , David Howells , Alban Crequy , Alexey Dobriyan Subject: Re: [PATCH v2] devpts: allow mounting with uid/gid of uint32_t Message-Id: <20150819004714.c06e4a70.akpm@linux-foundation.org> In-Reply-To: <20150819072431.GA2642@posteo.de> References: <882a878038efb5fed381be5d4817ff44d90703d5.1439904209.git.dpark@posteo.net> <692839ff7158dbb96dd20ce8e36c13f85fa64fd7.1439910753.git.dpark@posteo.net> <20150818164425.76b9df40f94bbd2a57d0d518@linux-foundation.org> <20150819072431.GA2642@posteo.de> X-Mailer: Sylpheed 2.7.1 (GTK+ 2.18.9; x86_64-redhat-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1682 Lines: 52 On Wed, 19 Aug 2015 09:24:31 +0200 Dongsu Park 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... -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/