From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755310AbcBIBoP (ORCPT ); Mon, 8 Feb 2016 20:44:15 -0500 Received: from zeniv.linux.org.uk ([195.92.253.2]:56669 "EHLO ZenIV.linux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752699AbcBIBoO (ORCPT ); Mon, 8 Feb 2016 20:44:14 -0500 Date: Tue, 9 Feb 2016 01:44:06 +0000 From: Al Viro To: Arnd Bergmann Cc: Andrzej Hajda , Andrew Morton , Bartlomiej Zolnierkiewicz , Marek Szyprowski , open list , Bob Peterson Subject: Re: [PATCH v3] err.h: allow IS_ERR_VALUE to handle properly more types Message-ID: <20160209014406.GD17997@ZenIV.linux.org.uk> References: <20160202163350.f7d42f4b97f48756f3900e9a@linux-foundation.org> <2046663.fHIlWH1ph1@wuerfel> <56B855C3.5010006@samsung.com> <5549573.1i7GpRbvFd@wuerfel> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <5549573.1i7GpRbvFd@wuerfel> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Feb 08, 2016 at 01:01:32PM +0100, Arnd Bergmann wrote: > /git/arm-soc/fs/afs/write.c: In function 'afs_file_write': > /git/arm-soc/fs/afs/write.c:646:201: error: call to '__compiletime_assert_646' declared with attribute error: IS_ERR_VALUE takes an unsigned argument > make[4]: *** [fs/afs/write.o] Error 1 > make[4]: Target `__build' not remade because of errors. > make[3]: *** [fs/afs] Error 2 ... and taking a look at that code, we see this: if (IS_ERR_VALUE(result)) { _leave(" = %zd", result); return result; } _leave(" = %zd", result); return result; Further grep for that shows e.g. /* determine the length of the filename */ nlen = romfs_dev_strnlen(sb, pos + ROMFH_SIZE, ROMFS_MAXFN); if (IS_ERR_VALUE(nlen)) goto eio; which is also fucked in head, seeing that nlen should simply have been int there, with check being if (nlen < 0). But that would've been insufficiently future-proof, I suppose - what if somebody wishes to modify romfs to allow 2Gb-long file names? For sarcasm-impaired: use of IS_ERR_VALUE turns out to be a nice red flag. Often of the "I'm too lazy to check the calling conventions, let's gamble on IS_ERR_VALUE doing no harm and to hell with whoever will be scratching head reading the results" variety...