Fix unintentional integer overflow reported by Coverity by adding
the ULL suffix to the numerical literals used in the multiplication.

Fixes: e85e8a7541cb ("hash: Avoid 64bit crc intrinsics on 32bit aligned data.")
Signed-off-by: Eelco Chaudron <[email protected]>
---
 lib/hash.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/hash.h b/lib/hash.h
index 307309fd0..850e031ae 100644
--- a/lib/hash.h
+++ b/lib/hash.h
@@ -193,7 +193,7 @@ hash_finish32(uint64_t hash, uint32_t final, uint32_t 
semifinal)
     /* The finishing multiplier 0x805204f3 has been experimentally
      * derived to pass the testsuite hash tests. */
     hash = _mm_crc32_u32(hash, semifinal);
-    hash = _mm_crc32_u32(hash, final) * 0x805204f3;
+    hash = _mm_crc32_u32(hash, final) * 0x805204f3ULL;
     return hash ^ ((uint32_t) hash >> 16); /* Increase entropy in LSBs. */
 }
 
-- 
2.46.0

_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to