linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ipw2200: Fix permissions setted by DEVICE_ATTR
@ 2022-03-25  7:41 Meng Tang
  2022-03-25 19:37 ` Andrew Lunn
  2022-03-29 20:41 ` Stanislav Yakovlev
  0 siblings, 2 replies; 3+ messages in thread
From: Meng Tang @ 2022-03-25  7:41 UTC (permalink / raw)
  To: stas.yakovlev, kvalo, kuba, pabeni
  Cc: linux-wireless, netdev, linux-kernel, Meng Tang

Because xcode_version and rtc only implement the show function
and do not provide the store function, so ucode_version and rtc
only need the read permission, not need the write permission more.

So, remove the write permission from xcode_version and rtc.

Signed-off-by: Meng Tang <tangmeng@uniontech.com>
---
 drivers/net/wireless/intel/ipw2x00/ipw2200.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/intel/ipw2x00/ipw2200.c b/drivers/net/wireless/intel/ipw2x00/ipw2200.c
index 6830e88c4ed6..fa4f38d54d0a 100644
--- a/drivers/net/wireless/intel/ipw2x00/ipw2200.c
+++ b/drivers/net/wireless/intel/ipw2x00/ipw2200.c
@@ -1578,7 +1578,7 @@ static ssize_t show_ucode_version(struct device *d,
 	return sprintf(buf, "0x%08x\n", tmp);
 }
 
-static DEVICE_ATTR(ucode_version, 0644, show_ucode_version, NULL);
+static DEVICE_ATTR(ucode_version, 0444, show_ucode_version, NULL);
 
 static ssize_t show_rtc(struct device *d, struct device_attribute *attr,
 			char *buf)
@@ -1592,7 +1592,7 @@ static ssize_t show_rtc(struct device *d, struct device_attribute *attr,
 	return sprintf(buf, "0x%08x\n", tmp);
 }
 
-static DEVICE_ATTR(rtc, 0644, show_rtc, NULL);
+static DEVICE_ATTR(rtc, 0444, show_rtc, NULL);
 
 /*
  * Add a device attribute to view/control the delay between eeprom
-- 
2.20.1




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

* Re: [PATCH] ipw2200: Fix permissions setted by DEVICE_ATTR
  2022-03-25  7:41 [PATCH] ipw2200: Fix permissions setted by DEVICE_ATTR Meng Tang
@ 2022-03-25 19:37 ` Andrew Lunn
  2022-03-29 20:41 ` Stanislav Yakovlev
  1 sibling, 0 replies; 3+ messages in thread
From: Andrew Lunn @ 2022-03-25 19:37 UTC (permalink / raw)
  To: Meng Tang
  Cc: stas.yakovlev, kvalo, kuba, pabeni, linux-wireless, netdev, linux-kernel

On Fri, Mar 25, 2022 at 03:41:41PM +0800, Meng Tang wrote:
> Because xcode_version and rtc only implement the show function
> and do not provide the store function, so ucode_version and rtc
> only need the read permission, not need the write permission more.
> 
> So, remove the write permission from xcode_version and rtc.
> 
> Signed-off-by: Meng Tang <tangmeng@uniontech.com>
> ---
>  drivers/net/wireless/intel/ipw2x00/ipw2200.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/wireless/intel/ipw2x00/ipw2200.c b/drivers/net/wireless/intel/ipw2x00/ipw2200.c
> index 6830e88c4ed6..fa4f38d54d0a 100644
> --- a/drivers/net/wireless/intel/ipw2x00/ipw2200.c
> +++ b/drivers/net/wireless/intel/ipw2x00/ipw2200.c
> @@ -1578,7 +1578,7 @@ static ssize_t show_ucode_version(struct device *d,
>  	return sprintf(buf, "0x%08x\n", tmp);
>  }
>  
> -static DEVICE_ATTR(ucode_version, 0644, show_ucode_version, NULL);
> +static DEVICE_ATTR(ucode_version, 0444, show_ucode_version, NULL);

DEVICE_ATTR_RO() exists to make this more obvious. But it looks like
you would need to rename the show_ucode_version() to
ucode_version_show() in order to use it.

     Andrew

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

* Re: [PATCH] ipw2200: Fix permissions setted by DEVICE_ATTR
  2022-03-25  7:41 [PATCH] ipw2200: Fix permissions setted by DEVICE_ATTR Meng Tang
  2022-03-25 19:37 ` Andrew Lunn
@ 2022-03-29 20:41 ` Stanislav Yakovlev
  1 sibling, 0 replies; 3+ messages in thread
From: Stanislav Yakovlev @ 2022-03-29 20:41 UTC (permalink / raw)
  To: Meng Tang; +Cc: kvalo, Jakub Kicinski, pabeni, wireless, netdev, linux-kernel

On Fri, 25 Mar 2022 at 03:42, Meng Tang <tangmeng@uniontech.com> wrote:
>
> Because xcode_version and rtc only implement the show function
> and do not provide the store function, so ucode_version and rtc
> only need the read permission, not need the write permission more.
>
> So, remove the write permission from xcode_version and rtc.
>
> Signed-off-by: Meng Tang <tangmeng@uniontech.com>
> ---
>  drivers/net/wireless/intel/ipw2x00/ipw2200.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>

Looks fine, thanks!

Stanislav.

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

end of thread, other threads:[~2022-03-29 20:42 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-25  7:41 [PATCH] ipw2200: Fix permissions setted by DEVICE_ATTR Meng Tang
2022-03-25 19:37 ` Andrew Lunn
2022-03-29 20:41 ` Stanislav Yakovlev

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