linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] kernel: ksysfs: add __ro_after_init to bin_attribute structure
@ 2017-02-11 19:06 Bhumika Goyal
  2017-02-13 22:10 ` Kees Cook
  0 siblings, 1 reply; 2+ messages in thread
From: Bhumika Goyal @ 2017-02-11 19:06 UTC (permalink / raw)
  To: julia.lawall, linux-kernel, paulmck, ptesarik, keescook; +Cc: Bhumika Goyal

The object notes_attr of type bin_attribute is not modified after
getting initailized by ksysfs_init. Apart from initialization in
ksysfs_init it is also passed as an argument to the function
sysfs_create_bin_file but this argument is of type const. Therefore, add
__ro_after_init to its declaration.

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
---
 kernel/ksysfs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/ksysfs.c b/kernel/ksysfs.c
index ee1bc1b..0999679 100644
--- a/kernel/ksysfs.c
+++ b/kernel/ksysfs.c
@@ -195,7 +195,7 @@ static ssize_t notes_read(struct file *filp, struct kobject *kobj,
 	return count;
 }
 
-static struct bin_attribute notes_attr = {
+static struct bin_attribute notes_attr __ro_after_init  = {
 	.attr = {
 		.name = "notes",
 		.mode = S_IRUGO,
-- 
1.9.1

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

* Re: [PATCH] kernel: ksysfs: add __ro_after_init to bin_attribute structure
  2017-02-11 19:06 [PATCH] kernel: ksysfs: add __ro_after_init to bin_attribute structure Bhumika Goyal
@ 2017-02-13 22:10 ` Kees Cook
  0 siblings, 0 replies; 2+ messages in thread
From: Kees Cook @ 2017-02-13 22:10 UTC (permalink / raw)
  To: Bhumika Goyal, Andrew Morton
  Cc: Julia Lawall, LKML, Paul E. McKenney, Petr Tesarik

On Sat, Feb 11, 2017 at 11:06 AM, Bhumika Goyal <bhumirks@gmail.com> wrote:
> The object notes_attr of type bin_attribute is not modified after
> getting initailized by ksysfs_init. Apart from initialization in
> ksysfs_init it is also passed as an argument to the function
> sysfs_create_bin_file but this argument is of type const. Therefore, add
> __ro_after_init to its declaration.
>
> Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>

Looks good to me.

Acked-by: Kees Cook <keescook@chromium.org>

It looks like akpm historically carries changes in this area?

-Kees

> ---
>  kernel/ksysfs.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/kernel/ksysfs.c b/kernel/ksysfs.c
> index ee1bc1b..0999679 100644
> --- a/kernel/ksysfs.c
> +++ b/kernel/ksysfs.c
> @@ -195,7 +195,7 @@ static ssize_t notes_read(struct file *filp, struct kobject *kobj,
>         return count;
>  }
>
> -static struct bin_attribute notes_attr = {
> +static struct bin_attribute notes_attr __ro_after_init  = {
>         .attr = {
>                 .name = "notes",
>                 .mode = S_IRUGO,
> --
> 1.9.1
>



-- 
Kees Cook
Pixel Security

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

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

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-11 19:06 [PATCH] kernel: ksysfs: add __ro_after_init to bin_attribute structure Bhumika Goyal
2017-02-13 22:10 ` Kees Cook

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).