From 3130692343c13a8b3fc52a830df42cd437ccef2e Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Thu, 22 Jun 2017 03:49:57 +0200 Subject: main: annotate init/exit functions to save memory --- src/selftest/blake2s.h | 6 +++--- src/selftest/chacha20poly1305.h | 10 +++++----- src/selftest/counter.h | 2 +- src/selftest/curve25519.h | 4 ++-- src/selftest/routingtable.h | 36 ++++++++++++++++++------------------ 5 files changed, 29 insertions(+), 29 deletions(-) (limited to 'src/selftest') diff --git a/src/selftest/blake2s.h b/src/selftest/blake2s.h index 7b9f352..94dda27 100644 --- a/src/selftest/blake2s.h +++ b/src/selftest/blake2s.h @@ -1,7 +1,7 @@ /* Copyright (C) 2015-2017 Jason A. Donenfeld . All Rights Reserved. */ #ifdef DEBUG -static const u8 blake2s_testvecs[][BLAKE2S_OUTBYTES] = { +static const u8 blake2s_testvecs[][BLAKE2S_OUTBYTES] __initconst = { { 0x69, 0x21, 0x7A, 0x30, 0x79, 0x90, 0x80, 0x94, 0xE1, 0x11, 0x21, 0xD0, 0x42, 0x35, 0x4A, 0x7C, 0x1F, 0x55, 0xB6, 0x48, 0x2C, 0xA1, 0xA5, 0x1E, 0x1B, 0x25, 0x0D, 0xFD, 0x1E, 0xD0, 0xEE, 0xF9 }, { 0xE3, 0x4D, 0x74, 0xDB, 0xAF, 0x4F, 0xF4, 0xC6, 0xAB, 0xD8, 0x71, 0xCC, 0x22, 0x04, 0x51, 0xD2, 0xEA, 0x26, 0x48, 0x84, 0x6C, 0x77, 0x57, 0xFB, 0xAA, 0xC8, 0x2F, 0xE5, 0x1A, 0xD6, 0x4B, 0xEA }, { 0xDD, 0xAD, 0x9A, 0xB1, 0x5D, 0xAC, 0x45, 0x49, 0xBA, 0x42, 0xF4, 0x9D, 0x26, 0x24, 0x96, 0xBE, 0xF6, 0xC0, 0xBA, 0xE1, 0xDD, 0x34, 0x2A, 0x88, 0x08, 0xF8, 0xEA, 0x26, 0x7C, 0x6E, 0x21, 0x0C }, @@ -260,7 +260,7 @@ static const u8 blake2s_testvecs[][BLAKE2S_OUTBYTES] = { { 0xF0, 0x3F, 0x57, 0x89, 0xD3, 0x33, 0x6B, 0x80, 0xD0, 0x02, 0xD5, 0x9F, 0xDF, 0x91, 0x8B, 0xDB, 0x77, 0x5B, 0x00, 0x95, 0x6E, 0xD5, 0x52, 0x8E, 0x86, 0xAA, 0x99, 0x4A, 0xCB, 0x38, 0xFE, 0x2D } }; -static const u8 blake2s_keyed_testvecs[][BLAKE2S_OUTBYTES] = { +static const u8 blake2s_keyed_testvecs[][BLAKE2S_OUTBYTES] __initconst = { { 0x48, 0xA8, 0x99, 0x7D, 0xA4, 0x07, 0x87, 0x6B, 0x3D, 0x79, 0xC0, 0xD9, 0x23, 0x25, 0xAD, 0x3B, 0x89, 0xCB, 0xB7, 0x54, 0xD8, 0x6A, 0xB7, 0x1A, 0xEE, 0x04, 0x7A, 0xD3, 0x45, 0xFD, 0x2C, 0x49 }, { 0x40, 0xD1, 0x5F, 0xEE, 0x7C, 0x32, 0x88, 0x30, 0x16, 0x6A, 0xC3, 0xF9, 0x18, 0x65, 0x0F, 0x80, 0x7E, 0x7E, 0x01, 0xE1, 0x77, 0x25, 0x8C, 0xDC, 0x0A, 0x39, 0xB1, 0x1F, 0x59, 0x80, 0x66, 0xF1 }, { 0x6B, 0xB7, 0x13, 0x00, 0x64, 0x4C, 0xD3, 0x99, 0x1B, 0x26, 0xCC, 0xD4, 0xD2, 0x74, 0xAC, 0xD1, 0xAD, 0xEA, 0xB8, 0xB1, 0xD7, 0x91, 0x45, 0x46, 0xC1, 0x19, 0x8B, 0xBE, 0x9F, 0xC9, 0xD8, 0x03 }, @@ -519,7 +519,7 @@ static const u8 blake2s_keyed_testvecs[][BLAKE2S_OUTBYTES] = { { 0x3F, 0xB7, 0x35, 0x06, 0x1A, 0xBC, 0x51, 0x9D, 0xFE, 0x97, 0x9E, 0x54, 0xC1, 0xEE, 0x5B, 0xFA, 0xD0, 0xA9, 0xD8, 0x58, 0xB3, 0x31, 0x5B, 0xAD, 0x34, 0xBD, 0xE9, 0x99, 0xEF, 0xD7, 0x24, 0xDD } }; -bool blake2s_selftest(void) +bool __init blake2s_selftest(void) { u8 key[BLAKE2S_KEYBYTES]; u8 buf[ARRAY_SIZE(blake2s_testvecs)]; diff --git a/src/selftest/chacha20poly1305.h b/src/selftest/chacha20poly1305.h index cac0447..bdbb149 100644 --- a/src/selftest/chacha20poly1305.h +++ b/src/selftest/chacha20poly1305.h @@ -6,7 +6,7 @@ struct chacha20poly1305_testvec { u8 *key, *nonce, *assoc, *input, *result; size_t alen, ilen; }; -static const struct chacha20poly1305_testvec chacha20poly1305_enc_vectors[] = { { +static const struct chacha20poly1305_testvec chacha20poly1305_enc_vectors[] __initconst = { { .key = "\x1c\x92\x40\xa5\xeb\x55\xd3\x8a\xf3\x33\x88\x86\x04\xf6\xb5\xf0\x47\x39\x17\xc1\x40\x2b\x80\x09\x9d\xca\x5c\xbc\x20\x70\x75\xc0", .nonce = "\x01\x02\x03\x04\x05\x06\x07\x08", .assoc = "\xf3\x33\x88\x86\x00\x00\x00\x00\x00\x00\x4e\x91", @@ -15,7 +15,7 @@ static const struct chacha20poly1305_testvec chacha20poly1305_enc_vectors[] = { .ilen = 265, .result = "\x64\xa0\x86\x15\x75\x86\x1a\xf4\x60\xf0\x62\xc7\x9b\xe6\x43\xbd\x5e\x80\x5c\xfd\x34\x5c\xf3\x89\xf1\x08\x67\x0a\xc7\x6c\x8c\xb2\x4c\x6c\xfc\x18\x75\x5d\x43\xee\xa0\x9e\xe9\x4e\x38\x2d\x26\xb0\xbd\xb7\xb7\x3c\x32\x1b\x01\x00\xd4\xf0\x3b\x7f\x35\x58\x94\xcf\x33\x2f\x83\x0e\x71\x0b\x97\xce\x98\xc8\xa8\x4a\xbd\x0b\x94\x81\x14\xad\x17\x6e\x00\x8d\x33\xbd\x60\xf9\x82\xb1\xff\x37\xc8\x55\x97\x97\xa0\x6e\xf4\xf0\xef\x61\xc1\x86\x32\x4e\x2b\x35\x06\x38\x36\x06\x90\x7b\x6a\x7c\x02\xb0\xf9\xf6\x15\x7b\x53\xc8\x67\xe4\xb9\x16\x6c\x76\x7b\x80\x4d\x46\xa5\x9b\x52\x16\xcd\xe7\xa4\xe9\x90\x40\xc5\xa4\x04\x33\x22\x5e\xe2\x82\xa1\xb0\xa0\x6c\x52\x3e\xaf\x45\x34\xd7\xf8\x3f\xa1\x15\x5b\x00\x47\x71\x8c\xbc\x54\x6a\x0d\x07\x2b\x04\xb3\x56\x4e\xea\x1b\x42\x22\x73\xf5\x48\x27\x1a\x0b\xb2\x31\x60\x53\xfa\x76\x99\x19\x55\xeb\xd6\x31\x59\x43\x4e\xce\xbb\x4e\x46\x6d\xae\x5a\x10\x73\xa6\x72\x76\x27\x09\x7a\x10\x49\xe6\x17\xd9\x1d\x36\x10\x94\xfa\x68\xf0\xff\x77\x98\x71\x30\x30\x5b\xea\xba\x2e\xda\x04\xdf\x99\x7b\x71\x4d\x6c\x6f\x2c\x29\xa6\xad\x5c\xb4\x02\x2b\x02\x70\x9b\xee\xad\x9d\x67\x89\x0c\xbb\x22\x39\x23\x36\xfe\xa1\x85\x1f\x38" } }; -static const struct chacha20poly1305_testvec chacha20poly1305_dec_vectors[] = { { +static const struct chacha20poly1305_testvec chacha20poly1305_dec_vectors[] __initconst = { { .key = "\x1c\x92\x40\xa5\xeb\x55\xd3\x8a\xf3\x33\x88\x86\x04\xf6\xb5\xf0\x47\x39\x17\xc1\x40\x2b\x80\x09\x9d\xca\x5c\xbc\x20\x70\x75\xc0", .nonce = "\x01\x02\x03\x04\x05\x06\x07\x08", .assoc = "\xf3\x33\x88\x86\x00\x00\x00\x00\x00\x00\x4e\x91", @@ -25,7 +25,7 @@ static const struct chacha20poly1305_testvec chacha20poly1305_dec_vectors[] = { .result = "\x49\x6e\x74\x65\x72\x6e\x65\x74\x2d\x44\x72\x61\x66\x74\x73\x20\x61\x72\x65\x20\x64\x72\x61\x66\x74\x20\x64\x6f\x63\x75\x6d\x65\x6e\x74\x73\x20\x76\x61\x6c\x69\x64\x20\x66\x6f\x72\x20\x61\x20\x6d\x61\x78\x69\x6d\x75\x6d\x20\x6f\x66\x20\x73\x69\x78\x20\x6d\x6f\x6e\x74\x68\x73\x20\x61\x6e\x64\x20\x6d\x61\x79\x20\x62\x65\x20\x75\x70\x64\x61\x74\x65\x64\x2c\x20\x72\x65\x70\x6c\x61\x63\x65\x64\x2c\x20\x6f\x72\x20\x6f\x62\x73\x6f\x6c\x65\x74\x65\x64\x20\x62\x79\x20\x6f\x74\x68\x65\x72\x20\x64\x6f\x63\x75\x6d\x65\x6e\x74\x73\x20\x61\x74\x20\x61\x6e\x79\x20\x74\x69\x6d\x65\x2e\x20\x49\x74\x20\x69\x73\x20\x69\x6e\x61\x70\x70\x72\x6f\x70\x72\x69\x61\x74\x65\x20\x74\x6f\x20\x75\x73\x65\x20\x49\x6e\x74\x65\x72\x6e\x65\x74\x2d\x44\x72\x61\x66\x74\x73\x20\x61\x73\x20\x72\x65\x66\x65\x72\x65\x6e\x63\x65\x20\x6d\x61\x74\x65\x72\x69\x61\x6c\x20\x6f\x72\x20\x74\x6f\x20\x63\x69\x74\x65\x20\x74\x68\x65\x6d\x20\x6f\x74\x68\x65\x72\x20\x74\x68\x61\x6e\x20\x61\x73\x20\x2f\xe2\x80\x9c\x77\x6f\x72\x6b\x20\x69\x6e\x20\x70\x72\x6f\x67\x72\x65\x73\x73\x2e\x2f\xe2\x80\x9d" } }; -static const struct chacha20poly1305_testvec xchacha20poly1305_enc_vectors[] = { { +static const struct chacha20poly1305_testvec xchacha20poly1305_enc_vectors[] __initconst = { { .key = "\x1c\x92\x40\xa5\xeb\x55\xd3\x8a\xf3\x33\x88\x86\x04\xf6\xb5\xf0\x47\x39\x17\xc1\x40\x2b\x80\x09\x9d\xca\x5c\xbc\x20\x70\x75\xc0", .nonce = "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f\x10\x11\x12\x13\x14\x15\x16\x17", .assoc = "\xf3\x33\x88\x86\x00\x00\x00\x00\x00\x00\x4e\x91", @@ -34,7 +34,7 @@ static const struct chacha20poly1305_testvec xchacha20poly1305_enc_vectors[] = { .ilen = 265, .result = "\x1a\x6e\x3a\xd9\xfd\x41\x3f\x77\x54\x72\x0a\x70\x9a\xa0\x29\x92\x2e\xed\x93\xcf\x0f\x71\x88\x18\x7a\x9d\x2d\x24\xe0\xf5\xea\x3d\x55\x64\xd7\xad\x2a\x1a\x1f\x7e\x86\x6d\xb0\xce\x80\x41\x72\x86\x26\xee\x84\xd7\xef\x82\x9e\xe2\x60\x9d\x5a\xfc\xf0\xe4\x19\x85\xea\x09\xc6\xfb\xb3\xa9\x50\x09\xec\x5e\x11\x90\xa1\xc5\x4e\x49\xef\x50\xd8\x8f\xe0\x78\xd7\xfd\xb9\x3b\xc9\xf2\x91\xc8\x25\xc8\xa7\x63\x60\xce\x10\xcd\xc6\x7f\xf8\x16\xf8\xe1\x0a\xd9\xde\x79\x50\x33\xf2\x16\x0f\x17\xba\xb8\x5d\xd8\xdf\x4e\x51\xa8\x39\xd0\x85\xca\x46\x6a\x10\xa7\xa3\x88\xef\x79\xb9\xf8\x24\xf3\xe0\x71\x7b\x76\x28\x46\x3a\x3a\x1b\x91\xb6\xd4\x3e\x23\xe5\x44\x15\xbf\x60\x43\x9d\xa4\xbb\xd5\x5f\x89\xeb\xef\x8e\xfd\xdd\xb4\x0d\x46\xf0\x69\x23\x63\xae\x94\xf5\x5e\xa5\xad\x13\x1c\x41\x76\xe6\x90\xd6\x6d\xa2\x8f\x97\x4c\xa8\x0b\xcf\x8d\x43\x2b\x9c\x9b\xc5\x58\xa5\xb6\x95\x9a\xbf\x81\xc6\x54\xc9\x66\x0c\xe5\x4f\x6a\x53\xa1\xe5\x0c\xba\x31\xde\x34\x64\x73\x8a\x3b\xbd\x92\x01\xdb\x71\x69\xf3\x58\x99\xbc\xd1\xcb\x4a\x05\xe2\x58\x9c\x25\x17\xcd\xdc\x83\xb7\xff\xfb\x09\x61\xad\xbf\x13\x5b\x5e\xed\x46\x82\x6f\x22\xd8\x93\xa6\x85\x5b\x40\x39\x5c\xc5\x9c" } }; -static const struct chacha20poly1305_testvec xchacha20poly1305_dec_vectors[] = { { +static const struct chacha20poly1305_testvec xchacha20poly1305_dec_vectors[] __initconst = { { .key = "\x1c\x92\x40\xa5\xeb\x55\xd3\x8a\xf3\x33\x88\x86\x04\xf6\xb5\xf0\x47\x39\x17\xc1\x40\x2b\x80\x09\x9d\xca\x5c\xbc\x20\x70\x75\xc0", .nonce = "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f\x10\x11\x12\x13\x14\x15\x16\x17", .assoc = "\xf3\x33\x88\x86\x00\x00\x00\x00\x00\x00\x4e\x91", @@ -44,7 +44,7 @@ static const struct chacha20poly1305_testvec xchacha20poly1305_dec_vectors[] = { .result = "\x49\x6e\x74\x65\x72\x6e\x65\x74\x2d\x44\x72\x61\x66\x74\x73\x20\x61\x72\x65\x20\x64\x72\x61\x66\x74\x20\x64\x6f\x63\x75\x6d\x65\x6e\x74\x73\x20\x76\x61\x6c\x69\x64\x20\x66\x6f\x72\x20\x61\x20\x6d\x61\x78\x69\x6d\x75\x6d\x20\x6f\x66\x20\x73\x69\x78\x20\x6d\x6f\x6e\x74\x68\x73\x20\x61\x6e\x64\x20\x6d\x61\x79\x20\x62\x65\x20\x75\x70\x64\x61\x74\x65\x64\x2c\x20\x72\x65\x70\x6c\x61\x63\x65\x64\x2c\x20\x6f\x72\x20\x6f\x62\x73\x6f\x6c\x65\x74\x65\x64\x20\x62\x79\x20\x6f\x74\x68\x65\x72\x20\x64\x6f\x63\x75\x6d\x65\x6e\x74\x73\x20\x61\x74\x20\x61\x6e\x79\x20\x74\x69\x6d\x65\x2e\x20\x49\x74\x20\x69\x73\x20\x69\x6e\x61\x70\x70\x72\x6f\x70\x72\x69\x61\x74\x65\x20\x74\x6f\x20\x75\x73\x65\x20\x49\x6e\x74\x65\x72\x6e\x65\x74\x2d\x44\x72\x61\x66\x74\x73\x20\x61\x73\x20\x72\x65\x66\x65\x72\x65\x6e\x63\x65\x20\x6d\x61\x74\x65\x72\x69\x61\x6c\x20\x6f\x72\x20\x74\x6f\x20\x63\x69\x74\x65\x20\x74\x68\x65\x6d\x20\x6f\x74\x68\x65\x72\x20\x74\x68\x61\x6e\x20\x61\x73\x20\x2f\xe2\x80\x9c\x77\x6f\x72\x6b\x20\x69\x6e\x20\x70\x72\x6f\x67\x72\x65\x73\x73\x2e\x2f\xe2\x80\x9d" } }; -bool chacha20poly1305_selftest(void) +bool __init chacha20poly1305_selftest(void) { size_t i; u8 computed_result[512]; diff --git a/src/selftest/counter.h b/src/selftest/counter.h index 3312408..56d6006 100644 --- a/src/selftest/counter.h +++ b/src/selftest/counter.h @@ -1,7 +1,7 @@ /* Copyright (C) 2015-2017 Jason A. Donenfeld . All Rights Reserved. */ #ifdef DEBUG -bool packet_counter_selftest(void) +bool __init packet_counter_selftest(void) { bool success = true; unsigned int test_num = 0, i; diff --git a/src/selftest/curve25519.h b/src/selftest/curve25519.h index 0ed3dae..17ff57a 100644 --- a/src/selftest/curve25519.h +++ b/src/selftest/curve25519.h @@ -7,7 +7,7 @@ struct curve25519_test_vector { u8 result[CURVE25519_POINT_SIZE]; bool valid; }; -static const struct curve25519_test_vector curve25519_test_vectors[] = { +static const struct curve25519_test_vector curve25519_test_vectors[] __initconst = { { .private = { 0x77, 0x07, 0x6d, 0x0a, 0x73, 0x18, 0xa5, 0x7d, 0x3c, 0x16, 0xc1, 0x72, 0x51, 0xb2, 0x66, 0x45, 0xdf, 0x4c, 0x2f, 0x87, 0xeb, 0xc0, 0x99, 0x2a, 0xb1, 0x77, 0xfb, 0xa5, 0x1d, 0xb9, 0x2c, 0x2a }, .public = { 0xde, 0x9e, 0xdb, 0x7d, 0x7b, 0x7d, 0xc1, 0xb4, 0xd3, 0x5b, 0x61, 0xc2, 0xec, 0xe4, 0x35, 0x37, 0x3f, 0x83, 0x43, 0xc8, 0x5b, 0x78, 0x67, 0x4d, 0xad, 0xfc, 0x7e, 0x14, 0x6f, 0x88, 0x2b, 0x4f }, @@ -51,7 +51,7 @@ static const struct curve25519_test_vector curve25519_test_vectors[] = { .valid = false } }; -bool curve25519_selftest(void) +bool __init curve25519_selftest(void) { bool success = true, ret; size_t i = 0; diff --git a/src/selftest/routingtable.h b/src/selftest/routingtable.h index 26ec5e0..2f052fa 100644 --- a/src/selftest/routingtable.h +++ b/src/selftest/routingtable.h @@ -4,7 +4,7 @@ #ifdef DEBUG_PRINT_TRIE_GRAPHVIZ #include -static void print_node(struct routing_table_node *node, u8 bits) +static __init void print_node(struct routing_table_node *node, u8 bits) { u32 color = 0; char *style = "dotted"; @@ -33,7 +33,7 @@ static void print_node(struct routing_table_node *node, u8 bits) print_node(node->bit[1], bits); } } -static void print_tree(struct routing_table_node *top, u8 bits) +static __init void print_tree(struct routing_table_node *top, u8 bits) { printk(KERN_DEBUG "digraph trie {\n"); print_node(top, bits); @@ -57,11 +57,11 @@ struct horrible_routing_table_node { uint8_t ip_version; void *value; }; -static void horrible_routing_table_init(struct horrible_routing_table *table) +static __init void horrible_routing_table_init(struct horrible_routing_table *table) { INIT_HLIST_HEAD(&table->head); } -static void horrible_routing_table_free(struct horrible_routing_table *table) +static __init void horrible_routing_table_free(struct horrible_routing_table *table) { struct hlist_node *h; struct horrible_routing_table_node *node; @@ -70,7 +70,7 @@ static void horrible_routing_table_free(struct horrible_routing_table *table) kfree(node); }; } -static inline union nf_inet_addr horrible_cidr_to_mask(uint8_t cidr) +static __init inline union nf_inet_addr horrible_cidr_to_mask(uint8_t cidr) { union nf_inet_addr mask; memset(&mask, 0x00, 128 / 8); @@ -79,14 +79,14 @@ static inline union nf_inet_addr horrible_cidr_to_mask(uint8_t cidr) mask.all[cidr / 32] = htonl((0xFFFFFFFFUL << (32 - (cidr % 32))) & 0xFFFFFFFFUL); return mask; } -static inline uint8_t horrible_mask_to_cidr(union nf_inet_addr subnet) +static __init inline uint8_t horrible_mask_to_cidr(union nf_inet_addr subnet) { return hweight32(subnet.all[0]) + hweight32(subnet.all[1]) + hweight32(subnet.all[2]) + hweight32(subnet.all[3]); } -static inline void horrible_mask_self(struct horrible_routing_table_node *node) +static __init inline void horrible_mask_self(struct horrible_routing_table_node *node) { if (node->ip_version == 4) node->ip.ip &= node->mask.ip; @@ -97,18 +97,18 @@ static inline void horrible_mask_self(struct horrible_routing_table_node *node) node->ip.ip6[3] &= node->mask.ip6[3]; } } -static inline bool horrible_match_v4(const struct horrible_routing_table_node *node, struct in_addr *ip) +static __init inline bool horrible_match_v4(const struct horrible_routing_table_node *node, struct in_addr *ip) { return (ip->s_addr & node->mask.ip) == node->ip.ip; } -static inline bool horrible_match_v6(const struct horrible_routing_table_node *node, struct in6_addr *ip) +static __init inline bool horrible_match_v6(const struct horrible_routing_table_node *node, struct in6_addr *ip) { return (ip->in6_u.u6_addr32[0] & node->mask.ip6[0]) == node->ip.ip6[0] && (ip->in6_u.u6_addr32[1] & node->mask.ip6[1]) == node->ip.ip6[1] && (ip->in6_u.u6_addr32[2] & node->mask.ip6[2]) == node->ip.ip6[2] && (ip->in6_u.u6_addr32[3] & node->mask.ip6[3]) == node->ip.ip6[3]; } -static void horrible_insert_ordered(struct horrible_routing_table *table, struct horrible_routing_table_node *node) +static __init void horrible_insert_ordered(struct horrible_routing_table *table, struct horrible_routing_table_node *node) { struct horrible_routing_table_node *other = NULL, *where = NULL; uint8_t my_cidr = horrible_mask_to_cidr(node->mask); @@ -131,7 +131,7 @@ static void horrible_insert_ordered(struct horrible_routing_table *table, struct else hlist_add_before(&node->table, &where->table); } -static int horrible_routing_table_insert_v4(struct horrible_routing_table *table, struct in_addr *ip, uint8_t cidr, void *value) +static __init int horrible_routing_table_insert_v4(struct horrible_routing_table *table, struct in_addr *ip, uint8_t cidr, void *value) { struct horrible_routing_table_node *node = kzalloc(sizeof(struct horrible_routing_table_node), GFP_KERNEL); if (!node) @@ -144,7 +144,7 @@ static int horrible_routing_table_insert_v4(struct horrible_routing_table *table horrible_insert_ordered(table, node); return 0; } -static int horrible_routing_table_insert_v6(struct horrible_routing_table *table, struct in6_addr *ip, uint8_t cidr, void *value) +static __init int horrible_routing_table_insert_v6(struct horrible_routing_table *table, struct in6_addr *ip, uint8_t cidr, void *value) { struct horrible_routing_table_node *node = kzalloc(sizeof(struct horrible_routing_table_node), GFP_KERNEL); if (!node) @@ -157,7 +157,7 @@ static int horrible_routing_table_insert_v6(struct horrible_routing_table *table horrible_insert_ordered(table, node); return 0; } -static void *horrible_routing_table_lookup_v4(struct horrible_routing_table *table, struct in_addr *ip) +static __init void *horrible_routing_table_lookup_v4(struct horrible_routing_table *table, struct in_addr *ip) { struct horrible_routing_table_node *node; void *ret = NULL; @@ -171,7 +171,7 @@ static void *horrible_routing_table_lookup_v4(struct horrible_routing_table *tab }; return ret; } -static void *horrible_routing_table_lookup_v6(struct horrible_routing_table *table, struct in6_addr *ip) +static __init void *horrible_routing_table_lookup_v6(struct horrible_routing_table *table, struct in6_addr *ip) { struct horrible_routing_table_node *node; void *ret = NULL; @@ -186,7 +186,7 @@ static void *horrible_routing_table_lookup_v6(struct horrible_routing_table *tab return ret; } -static bool randomized_test(void) +static __init bool randomized_test(void) { bool ret = false; unsigned int i, j, k, mutate_amount, cidr; @@ -318,7 +318,7 @@ free: } #endif -static inline struct in_addr *ip4(u8 a, u8 b, u8 c, u8 d) +static __init inline struct in_addr *ip4(u8 a, u8 b, u8 c, u8 d) { static struct in_addr ip; u8 *split = (u8 *)&ip; @@ -328,7 +328,7 @@ static inline struct in_addr *ip4(u8 a, u8 b, u8 c, u8 d) split[3] = d; return &ip; } -static inline struct in6_addr *ip6(u32 a, u32 b, u32 c, u32 d) +static __init inline struct in6_addr *ip6(u32 a, u32 b, u32 c, u32 d) { static struct in6_addr ip; __be32 *split = (__be32 *)&ip; @@ -368,7 +368,7 @@ static inline struct in6_addr *ip6(u32 a, u32 b, u32 c, u32 d) maybe_fail \ } while (0) -bool routing_table_selftest(void) +bool __init routing_table_selftest(void) { struct routing_table t; struct wireguard_peer *a = NULL, *b = NULL, *c = NULL, *d = NULL, *e = NULL, *f = NULL, *g = NULL, *h = NULL; -- cgit v1.2.3-59-g8ed1b