[PATCH] wifi: cfg80211: Constify struct cfg80211_ops

Christophe JAILLET posted 1 patch 1 week, 4 days ago
drivers/net/wireless/ath/ath6kl/cfg80211.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH] wifi: cfg80211: Constify struct cfg80211_ops
Posted by Christophe JAILLET 1 week, 4 days ago
'struct cfg80211_ops' is not modified in this driver.

Constifying this structure moves some data to a read-only section, so
increases overall security, especially when the structure holds some
function pointers.

On a x86_64, with allmodconfig, as an example:
Before:
======
   text	   data	    bss	    dec	    hex	filename
 143726	  34579	    192	 178497	  2b941	drivers/net/wireless/ath/ath6kl/cfg80211.o

After:
=====
   text	   data	    bss	    dec	    hex	filename
 144814	  33491	    192	 178497	  2b941	drivers/net/wireless/ath/ath6kl/cfg80211.o

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
Compile tested only.
---
 drivers/net/wireless/ath/ath6kl/cfg80211.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/ath6kl/cfg80211.c b/drivers/net/wireless/ath/ath6kl/cfg80211.c
index cc0f2c45fc3a..ecde91159b54 100644
--- a/drivers/net/wireless/ath/ath6kl/cfg80211.c
+++ b/drivers/net/wireless/ath/ath6kl/cfg80211.c
@@ -3437,7 +3437,7 @@ ath6kl_mgmt_stypes[NUM_NL80211_IFTYPES] = {
 	},
 };
 
-static struct cfg80211_ops ath6kl_cfg80211_ops = {
+static const struct cfg80211_ops ath6kl_cfg80211_ops = {
 	.add_virtual_intf = ath6kl_cfg80211_add_iface,
 	.del_virtual_intf = ath6kl_cfg80211_del_iface,
 	.change_virtual_intf = ath6kl_cfg80211_change_iface,
-- 
2.55.0
Re: [PATCH] wifi: cfg80211: Constify struct cfg80211_ops
Posted by Jeff Johnson 6 days, 4 hours ago
On Tue, 14 Jul 2026 09:14:00 +0200, Christophe JAILLET wrote:
> 'struct cfg80211_ops' is not modified in this driver.
> 
> Constifying this structure moves some data to a read-only section, so
> increases overall security, especially when the structure holds some
> function pointers.
> 
> On a x86_64, with allmodconfig, as an example:
> Before:
> ======
>    text	   data	    bss	    dec	    hex	filename
>  143726	  34579	    192	 178497	  2b941	drivers/net/wireless/ath/ath6kl/cfg80211.o
> 
> [...]

Applied, thanks!

[1/1] wifi: cfg80211: Constify struct cfg80211_ops
      commit: 612701854b588759c0df3094197d415869ada159

Best regards,
-- 
Jeff Johnson <jeff.johnson@oss.qualcomm.com>
Re: [PATCH] wifi: cfg80211: Constify struct cfg80211_ops
Posted by Jeff Johnson 1 week, 1 day ago
On 7/14/2026 12:14 AM, Christophe JAILLET wrote:

subject tags should be wifi: ath6kl:

I can fix this when I take the patch if there are no other comments

> 'struct cfg80211_ops' is not modified in this driver.
> 
> Constifying this structure moves some data to a read-only section, so
> increases overall security, especially when the structure holds some
> function pointers.
> 
> On a x86_64, with allmodconfig, as an example:
> Before:
> ======
>    text	   data	    bss	    dec	    hex	filename
>  143726	  34579	    192	 178497	  2b941	drivers/net/wireless/ath/ath6kl/cfg80211.o
> 
> After:
> =====
>    text	   data	    bss	    dec	    hex	filename
>  144814	  33491	    192	 178497	  2b941	drivers/net/wireless/ath/ath6kl/cfg80211.o
> 
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> ---
> Compile tested only.
> ---
>  drivers/net/wireless/ath/ath6kl/cfg80211.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/wireless/ath/ath6kl/cfg80211.c b/drivers/net/wireless/ath/ath6kl/cfg80211.c
> index cc0f2c45fc3a..ecde91159b54 100644
> --- a/drivers/net/wireless/ath/ath6kl/cfg80211.c
> +++ b/drivers/net/wireless/ath/ath6kl/cfg80211.c
> @@ -3437,7 +3437,7 @@ ath6kl_mgmt_stypes[NUM_NL80211_IFTYPES] = {
>  	},
>  };
>  
> -static struct cfg80211_ops ath6kl_cfg80211_ops = {
> +static const struct cfg80211_ops ath6kl_cfg80211_ops = {
>  	.add_virtual_intf = ath6kl_cfg80211_add_iface,
>  	.del_virtual_intf = ath6kl_cfg80211_del_iface,
>  	.change_virtual_intf = ath6kl_cfg80211_change_iface,