linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] PCI: acpiphp_ibm: add __ro_after_init to ibm_apci_table_attr
@ 2016-12-26 15:36 Bhumika Goyal
  2017-01-03 23:10 ` Kees Cook
  2017-01-11 21:00 ` Bjorn Helgaas
  0 siblings, 2 replies; 3+ messages in thread
From: Bhumika Goyal @ 2016-12-26 15:36 UTC (permalink / raw)
  To: julia.lawall, rjw, lenb, bhelgaas, linux-acpi, linux-pci, linux-kernel
  Cc: keescook, Bhumika Goyal

The object ibm_apci_table_attr of type bin_attribute structure is not
modified after getting initialized by ibm_acpiphp_init. Apart from
getting referenced in init it is also passed as an argument to the functions
sysfs_{remove/create}_bin_file but both the arguments are of type const 
struct bin_attribute *. Therefore add __ro_after_init to its declaration.

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

diff --git a/drivers/pci/hotplug/acpiphp_ibm.c b/drivers/pci/hotplug/acpiphp_ibm.c
index f6221d7..188cdfa 100644
--- a/drivers/pci/hotplug/acpiphp_ibm.c
+++ b/drivers/pci/hotplug/acpiphp_ibm.c
@@ -107,7 +107,7 @@ static acpi_status __init ibm_find_acpi_device(acpi_handle handle,
 
 static acpi_handle ibm_acpi_handle;
 static struct notification ibm_note;
-static struct bin_attribute ibm_apci_table_attr = {
+static struct bin_attribute ibm_apci_table_attr __ro_after_init = {
 	    .attr = {
 		    .name = "apci_table",
 		    .mode = S_IRUGO,
-- 
1.9.1

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

* Re: [PATCH] PCI: acpiphp_ibm: add __ro_after_init to ibm_apci_table_attr
  2016-12-26 15:36 [PATCH] PCI: acpiphp_ibm: add __ro_after_init to ibm_apci_table_attr Bhumika Goyal
@ 2017-01-03 23:10 ` Kees Cook
  2017-01-11 21:00 ` Bjorn Helgaas
  1 sibling, 0 replies; 3+ messages in thread
From: Kees Cook @ 2017-01-03 23:10 UTC (permalink / raw)
  To: Bhumika Goyal
  Cc: Julia Lawall, Rafael J. Wysocki, Len Brown, Bjorn Helgaas,
	ACPI Devel Maling List, linux-pci, LKML

On Mon, Dec 26, 2016 at 7:36 AM, Bhumika Goyal <bhumirks@gmail.com> wrote:
> The object ibm_apci_table_attr of type bin_attribute structure is not
> modified after getting initialized by ibm_acpiphp_init. Apart from
> getting referenced in init it is also passed as an argument to the functions
> sysfs_{remove/create}_bin_file but both the arguments are of type const
> struct bin_attribute *. Therefore add __ro_after_init to its declaration.
>
> Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
> ---
>  drivers/pci/hotplug/acpiphp_ibm.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/pci/hotplug/acpiphp_ibm.c b/drivers/pci/hotplug/acpiphp_ibm.c
> index f6221d7..188cdfa 100644
> --- a/drivers/pci/hotplug/acpiphp_ibm.c
> +++ b/drivers/pci/hotplug/acpiphp_ibm.c
> @@ -107,7 +107,7 @@ static acpi_status __init ibm_find_acpi_device(acpi_handle handle,
>
>  static acpi_handle ibm_acpi_handle;
>  static struct notification ibm_note;
> -static struct bin_attribute ibm_apci_table_attr = {
> +static struct bin_attribute ibm_apci_table_attr __ro_after_init = {
>             .attr = {
>                     .name = "apci_table",
>                     .mode = S_IRUGO,

Thanks!

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

-Kees

-- 
Kees Cook
Nexus Security

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

* Re: [PATCH] PCI: acpiphp_ibm: add __ro_after_init to ibm_apci_table_attr
  2016-12-26 15:36 [PATCH] PCI: acpiphp_ibm: add __ro_after_init to ibm_apci_table_attr Bhumika Goyal
  2017-01-03 23:10 ` Kees Cook
@ 2017-01-11 21:00 ` Bjorn Helgaas
  1 sibling, 0 replies; 3+ messages in thread
From: Bjorn Helgaas @ 2017-01-11 21:00 UTC (permalink / raw)
  To: Bhumika Goyal
  Cc: julia.lawall, rjw, lenb, bhelgaas, linux-acpi, linux-pci,
	linux-kernel, keescook

On Mon, Dec 26, 2016 at 09:06:35PM +0530, Bhumika Goyal wrote:
> The object ibm_apci_table_attr of type bin_attribute structure is not
> modified after getting initialized by ibm_acpiphp_init. Apart from
> getting referenced in init it is also passed as an argument to the functions
> sysfs_{remove/create}_bin_file but both the arguments are of type const 
> struct bin_attribute *. Therefore add __ro_after_init to its declaration.
> 
> Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>

Applied to pci/hotplug for v4.11 with Kees' Reviewed-by and the following
changelog:

    PCI: acpiphp_ibm: Make ibm_apci_table_attr __ro_after_init
    
    ibm_apci_table_attr is not modified after being initialized by
    ibm_acpiphp_init().  It is passed as an argument to the functions
    sysfs_{remove/create}_bin_file(), but both the arguments are const.
    Add __ro_after_init to its declaration.
    
    [bhelgaas: changelog]
    Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
    Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
    Reviewed-by: Kees Cook <keescook@chromium.org>

> ---
>  drivers/pci/hotplug/acpiphp_ibm.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/pci/hotplug/acpiphp_ibm.c b/drivers/pci/hotplug/acpiphp_ibm.c
> index f6221d7..188cdfa 100644
> --- a/drivers/pci/hotplug/acpiphp_ibm.c
> +++ b/drivers/pci/hotplug/acpiphp_ibm.c
> @@ -107,7 +107,7 @@ static acpi_status __init ibm_find_acpi_device(acpi_handle handle,
>  
>  static acpi_handle ibm_acpi_handle;
>  static struct notification ibm_note;
> -static struct bin_attribute ibm_apci_table_attr = {
> +static struct bin_attribute ibm_apci_table_attr __ro_after_init = {
>  	    .attr = {
>  		    .name = "apci_table",
>  		    .mode = S_IRUGO,
> -- 
> 1.9.1
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

end of thread, other threads:[~2017-01-11 21:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-12-26 15:36 [PATCH] PCI: acpiphp_ibm: add __ro_after_init to ibm_apci_table_attr Bhumika Goyal
2017-01-03 23:10 ` Kees Cook
2017-01-11 21:00 ` Bjorn Helgaas

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).