aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/send.c
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2018-09-04 10:44:42 -0600
committerJason A. Donenfeld <Jason@zx2c4.com>2018-09-04 11:08:29 -0600
commit6214b358a5502915d977d3f850d34bcad71c4cde (patch)
tree3f8849570e0ecbb60e9778ab38225705e1f46101 /src/send.c
parentglobal: satisfy check_patch.pl errors (diff)
downloadwireguard-monolithic-historical-6214b358a5502915d977d3f850d34bcad71c4cde.tar.xz
wireguard-monolithic-historical-6214b358a5502915d977d3f850d34bcad71c4cde.zip
global: prefer sizeof(*pointer) when possible
Suggested-by: Sultan Alsawaf <sultanxda@gmail.com>
Diffstat (limited to '')
-rw-r--r--src/send.c16
1 files changed, 6 insertions, 10 deletions
diff --git a/src/send.c b/src/send.c
index 38718c6..5b6d0fe 100644
--- a/src/send.c
+++ b/src/send.c
@@ -38,10 +38,8 @@ static void packet_send_handshake_initiation(struct wireguard_peer *peer)
timers_any_authenticated_packet_sent(peer);
atomic64_set(&peer->last_sent_handshake,
ktime_get_boot_fast_ns());
- socket_send_buffer_to_peer(
- peer, &packet,
- sizeof(struct message_handshake_initiation),
- HANDSHAKE_DSCP);
+ socket_send_buffer_to_peer(peer, &packet, sizeof(packet),
+ HANDSHAKE_DSCP);
timers_handshake_initiated(peer);
}
}
@@ -102,10 +100,9 @@ void packet_send_handshake_response(struct wireguard_peer *peer)
timers_any_authenticated_packet_sent(peer);
atomic64_set(&peer->last_sent_handshake,
ktime_get_boot_fast_ns());
- socket_send_buffer_to_peer(
- peer, &packet,
- sizeof(struct message_handshake_response),
- HANDSHAKE_DSCP);
+ socket_send_buffer_to_peer(peer, &packet,
+ sizeof(packet),
+ HANDSHAKE_DSCP);
}
}
}
@@ -200,8 +197,7 @@ static inline bool skb_encrypt(struct sk_buff *skb,
* and the header.
*/
skb_set_inner_network_header(skb, 0);
- header = (struct message_data *)skb_push(skb,
- sizeof(struct message_data));
+ header = (struct message_data *)skb_push(skb, sizeof(*header));
header->header.type = cpu_to_le32(MESSAGE_DATA);
header->key_idx = keypair->remote_index;
header->counter = cpu_to_le64(PACKET_CB(skb)->nonce);