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

crypto: x86 - eliminate anonymous module_init & module_exit

Eliminate anonymous module_init() and module_exit(), which can lead to
confusion or ambiguity when reading System.map, crashes/oops/bugs,
or an initcall_debug log.

Give each of these init and exit functions unique driver-specific
names to eliminate the anonymous names.

Example 1: (System.map)
ffffffff832fc78c t init
ffffffff832fc79e t init
ffffffff832fc8f8 t init

Example 2: (initcall_debug log)
calling init+0x0/0x12 @ 1
initcall init+0x0/0x12 returned 0 after 15 usecs
calling init+0x0/0x60 @ 1
initcall init+0x0/0x60 returned 0 after 2 usecs
calling init+0x0/0x9a @ 1
initcall init+0x0/0x9a returned 0 after 74 usecs

Fixes: 64b94ceae8c1 ("crypto: blowfish - add x86_64 assembly implementation")
Fixes: 676a38046f4f ("crypto: camellia-x86_64 - module init/exit functions should be static")
Fixes: 0b95ec56ae19 ("crypto: camellia - add assembler implementation for x86_64")
Fixes: 56d76c96a9f3 ("crypto: serpent - add AVX2/x86_64 assembler implementation of serpent cipher")
Fixes: b9f535ffe38f ("[CRYPTO] twofish: i586 assembly version")
Fixes: ff0a70fe0536 ("crypto: twofish-x86_64-3way - module init/exit functions should be static")
Fixes: 8280daad436e ("crypto: twofish - add 3-way parallel x86_64 assembler implemention")
Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Cc: Jussi Kivilinna <jussi.kivilinna@mbnet.fi>
Cc: Joachim Fritschi <jfritschi@freenet.de>
Cc: Herbert Xu <herbert@gondor.apana.org.au>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: linux-crypto@vger.kernel.org
Cc: x86@kernel.org
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

authored by

Randy Dunlap and committed by
Herbert Xu
f16a005c 4cda2f4a

+20 -20
+4 -4
arch/x86/crypto/blowfish_glue.c
··· 303 303 module_param(force, int, 0); 304 304 MODULE_PARM_DESC(force, "Force module load, ignore CPU blacklist"); 305 305 306 - static int __init init(void) 306 + static int __init blowfish_init(void) 307 307 { 308 308 int err; 309 309 ··· 327 327 return err; 328 328 } 329 329 330 - static void __exit fini(void) 330 + static void __exit blowfish_fini(void) 331 331 { 332 332 crypto_unregister_alg(&bf_cipher_alg); 333 333 crypto_unregister_skciphers(bf_skcipher_algs, 334 334 ARRAY_SIZE(bf_skcipher_algs)); 335 335 } 336 336 337 - module_init(init); 338 - module_exit(fini); 337 + module_init(blowfish_init); 338 + module_exit(blowfish_fini); 339 339 340 340 MODULE_LICENSE("GPL"); 341 341 MODULE_DESCRIPTION("Blowfish Cipher Algorithm, asm optimized");
+4 -4
arch/x86/crypto/camellia_glue.c
··· 1377 1377 module_param(force, int, 0); 1378 1378 MODULE_PARM_DESC(force, "Force module load, ignore CPU blacklist"); 1379 1379 1380 - static int __init init(void) 1380 + static int __init camellia_init(void) 1381 1381 { 1382 1382 int err; 1383 1383 ··· 1401 1401 return err; 1402 1402 } 1403 1403 1404 - static void __exit fini(void) 1404 + static void __exit camellia_fini(void) 1405 1405 { 1406 1406 crypto_unregister_alg(&camellia_cipher_alg); 1407 1407 crypto_unregister_skciphers(camellia_skcipher_algs, 1408 1408 ARRAY_SIZE(camellia_skcipher_algs)); 1409 1409 } 1410 1410 1411 - module_init(init); 1412 - module_exit(fini); 1411 + module_init(camellia_init); 1412 + module_exit(camellia_fini); 1413 1413 1414 1414 MODULE_LICENSE("GPL"); 1415 1415 MODULE_DESCRIPTION("Camellia Cipher Algorithm, asm optimized");
+4 -4
arch/x86/crypto/serpent_avx2_glue.c
··· 96 96 97 97 static struct simd_skcipher_alg *serpent_simd_algs[ARRAY_SIZE(serpent_algs)]; 98 98 99 - static int __init init(void) 99 + static int __init serpent_avx2_init(void) 100 100 { 101 101 const char *feature_name; 102 102 ··· 115 115 serpent_simd_algs); 116 116 } 117 117 118 - static void __exit fini(void) 118 + static void __exit serpent_avx2_fini(void) 119 119 { 120 120 simd_unregister_skciphers(serpent_algs, ARRAY_SIZE(serpent_algs), 121 121 serpent_simd_algs); 122 122 } 123 123 124 - module_init(init); 125 - module_exit(fini); 124 + module_init(serpent_avx2_init); 125 + module_exit(serpent_avx2_fini); 126 126 127 127 MODULE_LICENSE("GPL"); 128 128 MODULE_DESCRIPTION("Serpent Cipher Algorithm, AVX2 optimized");
+4 -4
arch/x86/crypto/twofish_glue.c
··· 81 81 } 82 82 }; 83 83 84 - static int __init init(void) 84 + static int __init twofish_glue_init(void) 85 85 { 86 86 return crypto_register_alg(&alg); 87 87 } 88 88 89 - static void __exit fini(void) 89 + static void __exit twofish_glue_fini(void) 90 90 { 91 91 crypto_unregister_alg(&alg); 92 92 } 93 93 94 - module_init(init); 95 - module_exit(fini); 94 + module_init(twofish_glue_init); 95 + module_exit(twofish_glue_fini); 96 96 97 97 MODULE_LICENSE("GPL"); 98 98 MODULE_DESCRIPTION ("Twofish Cipher Algorithm, asm optimized");
+4 -4
arch/x86/crypto/twofish_glue_3way.c
··· 140 140 module_param(force, int, 0); 141 141 MODULE_PARM_DESC(force, "Force module load, ignore CPU blacklist"); 142 142 143 - static int __init init(void) 143 + static int __init twofish_3way_init(void) 144 144 { 145 145 if (!force && is_blacklisted_cpu()) { 146 146 printk(KERN_INFO ··· 154 154 ARRAY_SIZE(tf_skciphers)); 155 155 } 156 156 157 - static void __exit fini(void) 157 + static void __exit twofish_3way_fini(void) 158 158 { 159 159 crypto_unregister_skciphers(tf_skciphers, ARRAY_SIZE(tf_skciphers)); 160 160 } 161 161 162 - module_init(init); 163 - module_exit(fini); 162 + module_init(twofish_3way_init); 163 + module_exit(twofish_3way_fini); 164 164 165 165 MODULE_LICENSE("GPL"); 166 166 MODULE_DESCRIPTION("Twofish Cipher Algorithm, 3-way parallel asm optimized");