From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932502AbbI3RUx (ORCPT ); Wed, 30 Sep 2015 13:20:53 -0400 Received: from mezzanine.sirena.org.uk ([106.187.55.193]:59000 "EHLO mezzanine.sirena.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753337AbbI3RUv (ORCPT ); Wed, 30 Sep 2015 13:20:51 -0400 Date: Wed, 30 Sep 2015 18:20:45 +0100 From: Mark Brown To: Rasmus Villemoes Cc: Greg Kroah-Hartman , linux-kernel@vger.kernel.org Message-ID: <20150930172045.GE15635@sirena.org.uk> References: <1443479342-31621-1-git-send-email-linux@rasmusvillemoes.dk> <20150929181455.GB30445@sirena.org.uk> <87pp10l639.fsf@rasmusvillemoes.dk> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="IDYEmSnFhs3mNXr+" Content-Disposition: inline In-Reply-To: <87pp10l639.fsf@rasmusvillemoes.dk> X-Cookie: Give him an evasive answer. User-Agent: Mutt/1.5.23 (2014-03-12) X-SA-Exim-Connect-IP: 2a01:348:6:8808:7e7a:91ff:fede:4a45 X-SA-Exim-Mail-From: broonie@sirena.org.uk Subject: Re: [PATCH 1/2] regmap: debugfs: remove bogus check X-SA-Exim-Version: 4.2.1 (built Mon, 26 Dec 2011 16:24:06 +0000) X-SA-Exim-Scanned: Yes (on mezzanine.sirena.org.uk) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --IDYEmSnFhs3mNXr+ Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Wed, Sep 30, 2015 at 09:27:38AM +0200, Rasmus Villemoes wrote: > I agree, but only on the word 'great'. There is value in removing such > bogosities (or rather, their presence provides negative value). It makes > the code harder to read ("why is this instance checked, but not any of > the other snprintfs?"); people may think that it's trying to check for > truncation, but it does no such thing; and it contributes a few > worthless bytes to .text (and the source). The solution to partial error checking isn't always to remove the error checking! > If you're worried about map->dev->driver->name actually ever being > 2G, > returning some almost totally random negative number isn't really > helpful (the function is supposed to return a -errno). And what makes > you think that in some hypothetical universe where the kernel's snprintf > explicit returns a negative value that it wouldn't just return -1 (aka > -EPERM)? This is going back to the discussion about having to learn the specific snprinf() implementation one is dealing with. --IDYEmSnFhs3mNXr+ Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQEcBAEBCAAGBQJWDBnsAAoJECTWi3JdVIfQKTkH/iHW6pl+HlEZkLa3A9Q4+Kn3 4zsVTw+wiMt8OW9rnrmnVsB5vsOBu1QbeiiAk1SdsVsO3Nv3MlE/U/1XJBScqvub cCiAuZWtqrK1CXsqAavgn4kPqzcy1cUhw6F/8iCwy0QZAlsKwECcVC3tApBkF6tC 0n3jt1udjPyZHW0HjMZ1qKDK5Esf8KqYwdndQBD9AaY3iHwygN8/1caswPVl9zfP uFT42bzzmzzIR9+Mpjgd5pPvAZcW8dF4jSx0iVme0IxVnU+jzOFhzo47A9tVUt/c AXY5Fs5sg7kpPhVVu/8qLm2LwJ3vcvITDONnJF6FhrRAvYn6CtcQg/oFBmvWlfA= =gNe1 -----END PGP SIGNATURE----- --IDYEmSnFhs3mNXr+--