diff options
Diffstat (limited to 'src/selftest/allowedips.h')
-rw-r--r-- | src/selftest/allowedips.h | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/src/selftest/allowedips.h b/src/selftest/allowedips.h index 28461d7..6b47fc8 100644 --- a/src/selftest/allowedips.h +++ b/src/selftest/allowedips.h @@ -176,8 +176,7 @@ static __init int horrible_allowedips_insert_v4(struct horrible_allowedips *table, struct in_addr *ip, uint8_t cidr, void *value) { - struct horrible_allowedips_node *node = - kzalloc(sizeof(struct horrible_allowedips_node), GFP_KERNEL); + struct horrible_allowedips_node *node = kzalloc(sizeof(*node), GFP_KERNEL); if (!node) return -ENOMEM; @@ -193,8 +192,7 @@ static __init int horrible_allowedips_insert_v6(struct horrible_allowedips *table, struct in6_addr *ip, uint8_t cidr, void *value) { - struct horrible_allowedips_node *node = - kzalloc(sizeof(struct horrible_allowedips_node), GFP_KERNEL); + struct horrible_allowedips_node *node = kzalloc(sizeof(*node), GFP_KERNEL); if (!node) return -ENOMEM; @@ -256,13 +254,13 @@ static __init bool randomized_test(void) allowedips_init(&t); horrible_allowedips_init(&h); - peers = kcalloc(NUM_PEERS, sizeof(struct wireguard_peer *), GFP_KERNEL); + peers = kcalloc(NUM_PEERS, sizeof(*peers), GFP_KERNEL); if (!peers) { pr_info("allowedips random self-test: out of memory\n"); goto free; } for (i = 0; i < NUM_PEERS; ++i) { - peers[i] = kzalloc(sizeof(struct wireguard_peer), GFP_KERNEL); + peers[i] = kzalloc(sizeof(*peers[i]), GFP_KERNEL); if (!peers[i]) { pr_info("allowedips random self-test: out of memory\n"); goto free; @@ -456,7 +454,7 @@ static __init int walk_callback(void *ctx, const u8 *ip, u8 cidr, int family) } #define init_peer(name) do { \ - name = kzalloc(sizeof(struct wireguard_peer), GFP_KERNEL); \ + name = kzalloc(sizeof(*name), GFP_KERNEL); \ if (!name) { \ pr_info("allowedips self-test: out of memory\n"); \ goto free; \ |