common/octeontx2: fix memory mapping API usage
[dpdk.git] / lib / librte_net / rte_ip.h
index a9ffc33..fcd1eb3 100644 (file)
@@ -139,8 +139,11 @@ __rte_raw_cksum(const void *buf, size_t len, uint32_t sum)
        }
 
        /* if length is in odd bytes */
-       if (len == 1)
-               sum += *((const uint8_t *)u16_buf);
+       if (len == 1) {
+               uint16_t left = 0;
+               *(uint8_t *)&left = *(const uint8_t *)u16_buf;
+               sum += left;
+       }
 
        return sum;
 }