Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

wifi: lib80211: Constify struct lib80211_crypto_ops

Now that functions in lib80211 handle "const struct lib80211_crypto_ops",
some structure can be constified as well.

Constifying these structures moves some data to a read-only section, so
increase overall security.

Before:
text data bss dec hex filename
7273 604 16 7893 1ed5 net/wireless/lib80211.o

After:
text data bss dec hex filename
7429 444 16 7889 1ed1 net/wireless/lib80211.o

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://patch.msgid.link/0cc3741c15f2c502cc85bddda9d6582b5977c8f9.1722839425.git.christophe.jaillet@wanadoo.fr
Signed-off-by: Johannes Berg <johannes.berg@intel.com>

authored by

Christophe JAILLET and committed by
Johannes Berg
18424420 3a3d1afd

+4 -4
+1 -1
net/wireless/lib80211.c
··· 234 234 { 235 235 } 236 236 237 - static struct lib80211_crypto_ops lib80211_crypt_null = { 237 + static const struct lib80211_crypto_ops lib80211_crypt_null = { 238 238 .name = "NULL", 239 239 .init = lib80211_crypt_null_init, 240 240 .deinit = lib80211_crypt_null_deinit,
+1 -1
net/wireless/lib80211_crypt_ccmp.c
··· 418 418 ccmp->dot11RSNAStatsCCMPDecryptErrors); 419 419 } 420 420 421 - static struct lib80211_crypto_ops lib80211_crypt_ccmp = { 421 + static const struct lib80211_crypto_ops lib80211_crypt_ccmp = { 422 422 .name = "CCMP", 423 423 .init = lib80211_ccmp_init, 424 424 .deinit = lib80211_ccmp_deinit,
+1 -1
net/wireless/lib80211_crypt_tkip.c
··· 705 705 tkip->dot11RSNAStatsTKIPLocalMICFailures); 706 706 } 707 707 708 - static struct lib80211_crypto_ops lib80211_crypt_tkip = { 708 + static const struct lib80211_crypto_ops lib80211_crypt_tkip = { 709 709 .name = "TKIP", 710 710 .init = lib80211_tkip_init, 711 711 .deinit = lib80211_tkip_deinit,
+1 -1
net/wireless/lib80211_crypt_wep.c
··· 226 226 seq_printf(m, "key[%d] alg=WEP len=%d\n", wep->key_idx, wep->key_len); 227 227 } 228 228 229 - static struct lib80211_crypto_ops lib80211_crypt_wep = { 229 + static const struct lib80211_crypto_ops lib80211_crypt_wep = { 230 230 .name = "WEP", 231 231 .init = lib80211_wep_init, 232 232 .deinit = lib80211_wep_deinit,