Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1236561

Re: [PATCH 1/2] regmap: debugfs: remove bogus check

From Mark Brown <broonie@kernel.org>
Newsgroups linux.kernel
Subject Re: [PATCH 1/2] regmap: debugfs: remove bogus check
Date 2015-09-30 19:30 +0200
Message-ID <qetmx-3dp-9@gated-at.bofh.it> (permalink)
References <qdP5L-4q2-3@gated-at.bofh.it> <qe7Fo-5O1-9@gated-at.bofh.it> <qejZU-6zb-19@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


[Multipart message — attachments visible in raw view] - view raw

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.

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 1/2] regmap: debugfs: remove bogus check Rasmus Villemoes <linux@rasmusvillemoes.dk> - 2015-09-29 00:30 +0200
  [PATCH 2/2] regmap: debugfs: improve regmap_reg_ranges_read_file() Rasmus Villemoes <linux@rasmusvillemoes.dk> - 2015-09-29 00:30 +0200
    Re: [PATCH 2/2] regmap: debugfs: improve  regmap_reg_ranges_read_file() Mark Brown <broonie@kernel.org> - 2015-09-29 20:40 +0200
      Re: [PATCH 2/2] regmap: debugfs: improve regmap_reg_ranges_read_file() Rasmus Villemoes <linux@rasmusvillemoes.dk> - 2015-09-30 12:00 +0200
        Re: [PATCH 2/2] regmap: debugfs: improve  regmap_reg_ranges_read_file() Mark Brown <broonie@kernel.org> - 2015-09-30 19:20 +0200
    [PATCH v2 2/3] regmap: debugfs: use memcpy instead of snprintf Rasmus Villemoes <linux@rasmusvillemoes.dk> - 2015-09-30 20:40 +0200
    [PATCH v2 3/3] regmap: debugfs: simplify regmap_reg_ranges_read_file() slightly Rasmus Villemoes <linux@rasmusvillemoes.dk> - 2015-09-30 20:40 +0200
    [PATCH v2 1/3] regmap: debugfs: use snprintf return value in regmap_reg_ranges_read_file() Rasmus Villemoes <linux@rasmusvillemoes.dk> - 2015-09-30 20:40 +0200
  Re: [PATCH 1/2] regmap: debugfs: remove bogus check Mark Brown <broonie@kernel.org> - 2015-09-29 20:20 +0200
    Re: [PATCH 1/2] regmap: debugfs: remove bogus check Rasmus Villemoes <linux@rasmusvillemoes.dk> - 2015-09-30 09:30 +0200
      Re: [PATCH 1/2] regmap: debugfs: remove bogus check Mark Brown <broonie@kernel.org> - 2015-09-30 19:30 +0200
        Re: [PATCH 1/2] regmap: debugfs: remove bogus check Rasmus Villemoes <linux@rasmusvillemoes.dk> - 2015-09-30 20:00 +0200
          Re: [PATCH 1/2] regmap: debugfs: remove bogus check Mark Brown <broonie@kernel.org> - 2015-09-30 20:20 +0200

csiph-web