From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756828AbcE0Vw1 (ORCPT ); Fri, 27 May 2016 17:52:27 -0400 Received: from zeniv.linux.org.uk ([195.92.253.2]:33734 "EHLO ZenIV.linux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756572AbcE0Vw0 (ORCPT ); Fri, 27 May 2016 17:52:26 -0400 Date: Fri, 27 May 2016 22:52:10 +0100 From: Al Viro To: Linus Torvalds Cc: Arnd Bergmann , Michal Marek , =?utf-8?B?0JzQsNC60YEg0JbRg9C60L7Qsg==?= , nicolas.ferre@atmel.com, Nicolas Pitre , robert.jarzmik@free.fr, yamada.masahiro@socionext.com, Linux Kbuild mailing list , Linux Kernel Mailing List , Bob Peterson Subject: Re: [GIT PULL] kbuild updates for v4.7-rc1 Message-ID: <20160527215210.GU14480@ZenIV.linux.org.uk> References: <20160526203346.GA4734@pobox.suse.cz> <5345273.JScMX9oohG@wuerfel> <9633365.kM71HHzq9d@wuerfel> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.6.0 (2016-04-01) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, May 27, 2016 at 01:20:29PM -0700, Linus Torvalds wrote: > I didn't look at the details of your patch, but I did look at several > IS_ERR_VALUE() uses in the standard kernel, and they were basically > all wrong. Even the ones that used it for the rigth reason (vm_brk() > that returns a pointer or an error in an "unsigned long") had actively > screwed up and truncated that (correct) unsigned long value to "int" > before doing the IS_ERR_VALUE(), which made it all wrong again. > > And the other users just looked entirely bogus, and were all just > "zero or negative error code" that has nothing to do with > IS_ERR_VALUE(). The code should just check against zero, not use that > macro that was designed for something different. Both gfs2 ones and the one in fs/romfs are crap. AFS one is simply ridiculous - result = generic_file_write_iter(iocb, from); if (IS_ERR_VALUE(result)) { _leave(" = %zd", result); return result; } _leave(" = %zd", result); return result; In binfmt*.c some callers are valid (vm_mmap and vm_brk values; BTW, the code in binfmt_flat.c checks for vm_mmap returning 0, which should never happen, AFAICS). Most of binfmt_flat.c ones are pure cargo-culting. net/9p/client.c ones are results of serious mistake in design of 9P.L extensions to 9P - they assume that numeric values of E... are architecture-independent and send them over the wire. The uses of IS_ERR_VALUE there are papering over that. Badly. A couple of sound/* ones should be simply "is negative". netfilter ones are caused by bad calling conventions of xt_percpu_counter_alloc(). I hadn't looked through drivers/* users, but judging by fs/, net/ and sound/, I would expect them to be pointless garbage in the best case and red flags for broken code in the worst. IMO IS_ERR_VALUE() should be renamed to something less generic and be used a lot less than it is right now.