From 68bc34c0e88b6eff8279201bdc2d16dab7a4dd68 Mon Sep 17 00:00:00 2001 From: Tobias Klauser Date: Wed, 14 Oct 2015 11:13:56 +0200 Subject: csum: Remove unnecessary memset in p4_csum() No need to memset the IPv4 pseudo header to 0 as all its members will explicitly be set. Also reorder the setting of the pseudo header to match the order of the fields. Signed-off-by: Tobias Klauser --- csum.h | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/csum.h b/csum.h index 19a8bc5..0d92c30 100644 --- a/csum.h +++ b/csum.h @@ -156,12 +156,11 @@ static inline uint16_t p4_csum(const struct ip *ip, const uint8_t *data, uint16_t len; } ph; - memset(&ph, 0, sizeof(ph)); - ph.len = htons(len); - ph.mbz = 0; - ph.proto = next_proto; ph.src = ip->ip_src.s_addr; ph.dst = ip->ip_dst.s_addr; + ph.mbz = 0; + ph.proto = next_proto; + ph.len = htons(len); vec[0].ptr = (const uint8_t *) (void *) &ph; vec[0].len = sizeof(ph); -- cgit v1.2.3-54-g00ecf