public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] checkpatch: don't complain on module_param(foo, bar, 0)
@ 2017-02-09  0:05 Brian Norris
  2017-02-23 22:10 ` Andy Shevchenko
  0 siblings, 1 reply; 3+ messages in thread
From: Brian Norris @ 2017-02-09  0:05 UTC (permalink / raw)
  To: Andy Whitcroft, Joe Perches; +Cc: linux-kernel, Brian Norris

The following code snippet:

    module_param(writeable, bool, 0);

yields this warning:

    ERROR: Use 4 digit octal (0777) not decimal permissions
    #390: FILE: drivers/mtd/spi-nor/intel-spi.c:143:
    +module_param(writeable, bool, 0);
    total: 1 errors, 0 warnings, 1006 lines checked

But 0000 is no easier to read than 0, and module_param() even
specifically refers to 0.

You can, for instance, test the patch:

    [PATCH v6 1/3] spi-nor: Add support for Intel SPI serial flash controller

like this:

    $ wget -qO - https://patchwork.ozlabs.org/patch/699946/mbox/ | scripts/checkpatch.pl -

Signed-off-by: Brian Norris <briannorris@chromium.org>
---
 scripts/checkpatch.pl | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 982c52ca6473..ada28aad8d64 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -6138,6 +6138,10 @@ sub process {
 				if ($stat =~ /$test/) {
 					my $val = $1;
 					$val = $6 if ($skip_args ne "");
+					# '0' is valid; some APIs special-case
+					# '0' as "no sysfs" node, and it's no
+					# harder to read than '0000'.
+					next if ($val eq "0");
 					if (($val =~ /^$Int$/ && $val !~ /^$Octal$/) ||
 					    ($val =~ /^$Octal$/ && length($val) ne 4)) {
 						ERROR("NON_OCTAL_PERMISSIONS",
-- 
2.11.0.483.g087da7b7c-goog

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] checkpatch: don't complain on module_param(foo, bar, 0)
  2017-02-09  0:05 [PATCH] checkpatch: don't complain on module_param(foo, bar, 0) Brian Norris
@ 2017-02-23 22:10 ` Andy Shevchenko
  2017-02-23 22:20   ` Joe Perches
  0 siblings, 1 reply; 3+ messages in thread
From: Andy Shevchenko @ 2017-02-23 22:10 UTC (permalink / raw)
  To: Brian Norris; +Cc: Andy Whitcroft, Joe Perches, linux-kernel@vger.kernel.org

On Thu, Feb 9, 2017 at 2:05 AM, Brian Norris <briannorris@chromium.org> wrote:
> The following code snippet:
>
>     module_param(writeable, bool, 0);
>
> yields this warning:
>
>     ERROR: Use 4 digit octal (0777) not decimal permissions
>     #390: FILE: drivers/mtd/spi-nor/intel-spi.c:143:
>     +module_param(writeable, bool, 0);
>     total: 1 errors, 0 warnings, 1006 lines checked
>
> But 0000 is no easier to read than 0, and module_param() even
> specifically refers to 0.

While this is all correct, the question is why we disallow to read
back on those parameters?

-- 
With Best Regards,
Andy Shevchenko

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] checkpatch: don't complain on module_param(foo, bar, 0)
  2017-02-23 22:10 ` Andy Shevchenko
@ 2017-02-23 22:20   ` Joe Perches
  0 siblings, 0 replies; 3+ messages in thread
From: Joe Perches @ 2017-02-23 22:20 UTC (permalink / raw)
  To: Andy Shevchenko, Brian Norris
  Cc: Andy Whitcroft, linux-kernel@vger.kernel.org

On Fri, 2017-02-24 at 00:10 +0200, Andy Shevchenko wrote:
> On Thu, Feb 9, 2017 at 2:05 AM, Brian Norris <briannorris@chromium.org> wrote:
> > The following code snippet:
> > 
> >     module_param(writeable, bool, 0);
> > 
> > yields this warning:
> > 
> >     ERROR: Use 4 digit octal (0777) not decimal permissions
> >     #390: FILE: drivers/mtd/spi-nor/intel-spi.c:143:
> >     +module_param(writeable, bool, 0);
> >     total: 1 errors, 0 warnings, 1006 lines checked
> > 
> > But 0000 is no easier to read than 0, and module_param() even
> > specifically refers to 0.
> 
> While this is all correct, the question is why we disallow to read
> back on those parameters?

why disallow root to read-back any parameter?

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-02-23 22:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-02-09  0:05 [PATCH] checkpatch: don't complain on module_param(foo, bar, 0) Brian Norris
2017-02-23 22:10 ` Andy Shevchenko
2017-02-23 22:20   ` Joe Perches

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox