[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20150930172045.GE15635@sirena.org.uk>
Date: Wed, 30 Sep 2015 18:20:45 +0100
From: Mark Brown <broonie@...nel.org>
To: Rasmus Villemoes <linux@...musvillemoes.dk>
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/2] regmap: debugfs: remove bogus check
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.
Download attachment "signature.asc" of type "application/pgp-signature" (474 bytes)
Powered by blists - more mailing lists