diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2018-09-04 10:44:42 -0600 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2018-09-04 11:08:29 -0600 |
commit | 4ed60c09ee40f22f99afd59f3ff94866b7aa0cc4 (patch) | |
tree | df5d7df445df552374ea62771c9ec2e3c6c511aa /src/selftest/allowedips.h | |
parent | 93b6e83e4faa8de6247e0e46d5060ec543befef8 (diff) |
global: prefer sizeof(*pointer) when possible
Suggested-by: Sultan Alsawaf <sultanxda@gmail.com>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
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; \ |