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


Groups > linux.kernel > #1624787 > unrolled thread

[PATCH 2/2 v2] char: misc: use octal permissions for the proc entry

Started byMartin Kaiser <martin@kaiser.cx>
First post2017-04-17 20:30 +0200
Last post2017-04-18 11:20 +0200
Articles 5 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH 2/2 v2] char: misc: use octal permissions for the proc entry Martin Kaiser <martin@kaiser.cx> - 2017-04-17 20:30 +0200
    Re: [PATCH 2/2 v2] char: misc: use octal permissions for the proc  entry Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-04-18 06:40 +0200
      Re: [PATCH 2/2 v2] char: misc: use octal permissions for the proc  entry Martin Kaiser <martin@kaiser.cx> - 2017-04-18 10:00 +0200
        Re: [PATCH 2/2 v2] char: misc: use octal permissions for the proc  entry Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-04-18 10:20 +0200
          Re: [PATCH 2/2 v2] char: misc: use octal permissions for the proc  entry Martin Kaiser <martin@kaiser.cx> - 2017-04-18 11:20 +0200

#1624787 — [PATCH 2/2 v2] char: misc: use octal permissions for the proc entry

FromMartin Kaiser <martin@kaiser.cx>
Date2017-04-17 20:30 +0200
Subject[PATCH 2/2 v2] char: misc: use octal permissions for the proc entry
Message-ID<txjzs-42t-3@gated-at.bofh.it>
Set the permissions for /proc/misc to 0444 explicitly. At the moment,
we're using 0 and have proc_create_data() convert this to 0444.
This fixes a checkpatch warning.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
---
v2:
   separate patch for each checkpatch warning

 drivers/char/misc.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/char/misc.c b/drivers/char/misc.c
index 3447b2e..3c633d5 100644
--- a/drivers/char/misc.c
+++ b/drivers/char/misc.c
@@ -280,7 +280,7 @@ static int __init misc_init(void)
 	int err;
 	struct proc_dir_entry *ret;
 
-	ret = proc_create("misc", 0, NULL, &misc_proc_fops);
+	ret = proc_create("misc", 0444, NULL, &misc_proc_fops);
 	misc_class = class_create(THIS_MODULE, "misc");
 	err = PTR_ERR(misc_class);
 	if (IS_ERR(misc_class))
-- 
1.7.10.4

[toc] | [next] | [standalone]


#1625014 — Re: [PATCH 2/2 v2] char: misc: use octal permissions for the proc entry

FromGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Date2017-04-18 06:40 +0200
SubjectRe: [PATCH 2/2 v2] char: misc: use octal permissions for the proc entry
Message-ID<txt5M-1FB-3@gated-at.bofh.it>
In reply to#1624787
On Mon, Apr 17, 2017 at 08:22:57PM +0200, Martin Kaiser wrote:
> Set the permissions for /proc/misc to 0444 explicitly. At the moment,
> we're using 0 and have proc_create_data() convert this to 0444.
> This fixes a checkpatch warning.
> 
> Signed-off-by: Martin Kaiser <martin@kaiser.cx>
> ---
> v2:
>    separate patch for each checkpatch warning
> 
>  drivers/char/misc.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/char/misc.c b/drivers/char/misc.c
> index 3447b2e..3c633d5 100644
> --- a/drivers/char/misc.c
> +++ b/drivers/char/misc.c
> @@ -280,7 +280,7 @@ static int __init misc_init(void)
>  	int err;
>  	struct proc_dir_entry *ret;
>  
> -	ret = proc_create("misc", 0, NULL, &misc_proc_fops);
> +	ret = proc_create("misc", 0444, NULL, &misc_proc_fops);

What checkpatch warning does this fix?  0 is a number :)

thanks,

greg k-h

[toc] | [prev] | [next] | [standalone]


#1625116 — Re: [PATCH 2/2 v2] char: misc: use octal permissions for the proc entry

FromMartin Kaiser <martin@kaiser.cx>
Date2017-04-18 10:00 +0200
SubjectRe: [PATCH 2/2 v2] char: misc: use octal permissions for the proc entry
Message-ID<txwdk-3uy-17@gated-at.bofh.it>
In reply to#1625014
Thus wrote Greg Kroah-Hartman (gregkh@linuxfoundation.org):

> > -	ret = proc_create("misc", 0, NULL, &misc_proc_fops);
> > +	ret = proc_create("misc", 0444, NULL, &misc_proc_fops);

> What checkpatch warning does this fix?  0 is a number :)

ERROR: Use 4 digit octal (0777) not decimal permissions
#285: FILE: drivers/char/misc.c:285:
+  ret = proc_create("misc", 0, NULL, &misc_proc_fops);

Best regards,

   Martin

[toc] | [prev] | [next] | [standalone]


#1625122 — Re: [PATCH 2/2 v2] char: misc: use octal permissions for the proc entry

FromGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Date2017-04-18 10:20 +0200
SubjectRe: [PATCH 2/2 v2] char: misc: use octal permissions for the proc entry
Message-ID<txwwG-3Q5-15@gated-at.bofh.it>
In reply to#1625116
On Tue, Apr 18, 2017 at 09:51:31AM +0200, Martin Kaiser wrote:
> Thus wrote Greg Kroah-Hartman (gregkh@linuxfoundation.org):
> 
> > > -	ret = proc_create("misc", 0, NULL, &misc_proc_fops);
> > > +	ret = proc_create("misc", 0444, NULL, &misc_proc_fops);
> 
> > What checkpatch warning does this fix?  0 is a number :)
> 
> ERROR: Use 4 digit octal (0777) not decimal permissions
> #285: FILE: drivers/char/misc.c:285:
> +  ret = proc_create("misc", 0, NULL, &misc_proc_fops);

Come on now, think about what this is saying.  Is 0 not also an octal
number?

checkpatch requires you to use your brain, it is but a dumb perl
script...

greg k-h

[toc] | [prev] | [next] | [standalone]


#1625172 — Re: [PATCH 2/2 v2] char: misc: use octal permissions for the proc entry

FromMartin Kaiser <martin@kaiser.cx>
Date2017-04-18 11:20 +0200
SubjectRe: [PATCH 2/2 v2] char: misc: use octal permissions for the proc entry
Message-ID<txxsJ-4oB-13@gated-at.bofh.it>
In reply to#1625122
Thus wrote Greg Kroah-Hartman (gregkh@linuxfoundation.org):

> > ERROR: Use 4 digit octal (0777) not decimal permissions
> > #285: FILE: drivers/char/misc.c:285:
> > +  ret = proc_create("misc", 0, NULL, &misc_proc_fops);

> Come on now, think about what this is saying.  Is 0 not also an octal
> number?

checkpatch is asking for a 4 digit octal number. And at least for me,
0444 makes it clearer what the permissions actually are. Yes, somewhere
in the code, I can dig up that 0 is changed to 0444...

> checkpatch requires you to use your brain, it is but a dumb perl
> script...

Sorry, I won't be arguing on a personal level.
If you don't like the patch, feel free to reject it. No problem for me.

Do you think checkpatch shouldn't be looking for exactly 4 digits here
(and elsewhere, it has a list of functions with a permission parameter)?

Best regards,

   Martin

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web