summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHan Han <hhan@redhat.com>2022-06-20 16:45:19 +0800
committerHan Han <hhan@redhat.com>2022-06-20 16:45:19 +0800
commit96d775860fb7e404d6acaf7e8dfbd171cfbcee15 (patch)
tree7199ba68409175271c949e340616bccdc8482d78
parent4bf4819a0dfddc53810a640e3be83dbbeeab0802 (diff)
downloadusbutils-96d775860fb7e404d6acaf7e8dfbd171cfbcee15.tar.gz
Fix an runtime error reported by undefind sanitizer
Fix the following error when compiling with undefined sanitizer: ./lsusb names.c:36:29: runtime error: left shift of 16 by 27 places cannot be represented in type 'int' Signed-off-by: Han Han <hhan@redhat.com>
-rw-r--r--names.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/names.c b/names.c
index c8cdd02..beae8f8 100644
--- a/names.c
+++ b/names.c
@@ -33,7 +33,7 @@
static unsigned int hashnum(unsigned int num)
{
- unsigned int mask1 = HASH1 << 27, mask2 = HASH2 << 27;
+ unsigned int mask1 = (unsigned int)HASH1 << 27, mask2 = (unsigned int)HASH2 << 27;
for (; mask1 >= HASH1; mask1 >>= 1, mask2 >>= 1)
if (num & mask1)