]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
wifi: wlcore: testmode: Constify strutc nla_policy
authorChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Mon, 11 Nov 2024 13:40:35 +0000 (14:40 +0100)
committerKalle Valo <kvalo@kernel.org>
Mon, 9 Dec 2024 15:58:43 +0000 (17:58 +0200)
'struct nla_policy' is not modified in this driver.

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

On a x86_64, with allmodconfig:
Before:
======
   text    data     bss     dec     hex filename
   5062     528       0    5590    15d6 drivers/net/wireless/ti/wlcore/testmode.o

After:
=====
   text    data     bss     dec     hex filename
   5178     404       0    5582    15ce drivers/net/wireless/ti/wlcore/testmode.o

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Reviewed-by: Jeff Johnson <quic_jjohnson@quicinc.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://patch.msgid.link/78810e3ebb74ddbd3a4538f182bf1143b89baba7.1731332414.git.christophe.jaillet@wanadoo.fr
drivers/net/wireless/ti/wlcore/testmode.c

index 3f338b8096c77cc4dd8784f53798f159683cbf5e..fc8ea58bc16597d84c305f913774f2761d112b4c 100644 (file)
@@ -45,7 +45,7 @@ enum wl1271_tm_attrs {
 };
 #define WL1271_TM_ATTR_MAX (__WL1271_TM_ATTR_AFTER_LAST - 1)
 
-static struct nla_policy wl1271_tm_policy[WL1271_TM_ATTR_MAX + 1] = {
+static const struct nla_policy wl1271_tm_policy[WL1271_TM_ATTR_MAX + 1] = {
        [WL1271_TM_ATTR_CMD_ID] =       { .type = NLA_U32 },
        [WL1271_TM_ATTR_ANSWER] =       { .type = NLA_U8 },
        [WL1271_TM_ATTR_DATA] =         { .type = NLA_BINARY,