From be6ac304dc051e63c0eb12bcd45959b189ca085d Mon Sep 17 00:00:00 2001 From: Michael Tuexen <tuexen@fh-muenster.de> Date: Thu, 4 Oct 2018 16:48:05 +0200 Subject: [PATCH] Don't use undefined behaviour. --- gtests/net/packetdrill/checksum.c | 2 +- gtests/net/packetdrill/ip_address.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/gtests/net/packetdrill/checksum.c b/gtests/net/packetdrill/checksum.c index 60dd6412..ae4e4743 100644 --- a/gtests/net/packetdrill/checksum.c +++ b/gtests/net/packetdrill/checksum.c @@ -239,7 +239,7 @@ static u32 crc_c[256] = { __be32 sctp_crc32c(const void *packet, u32 len) { u32 i, crc32c; - u8 byte0, byte1, byte2, byte3; + u32 byte0, byte1, byte2, byte3; const u8 *buf = (const u8 *)packet; crc32c = ~0; diff --git a/gtests/net/packetdrill/ip_address.c b/gtests/net/packetdrill/ip_address.c index 91e89c0f..6682632a 100644 --- a/gtests/net/packetdrill/ip_address.c +++ b/gtests/net/packetdrill/ip_address.c @@ -309,7 +309,7 @@ extern int netmask_to_prefix(const char *netmask) int prefix_len = 0; for (pos = 31; pos >= 0; --pos) { - if (!(mask_addr & (1<<pos))) + if (!(mask_addr & (1U<<pos))) break; ++prefix_len; } -- GitLab