Skip to content

Commit 9803c44

Browse files
stoeckmannlucasdemarchi
authored andcommitted
shared: Use uint8_t in hash_superfast
Characters in key are supposed to be handled unsigned. Explicitly cast key[2] in case the key contains 8-bit ASCII. Even though we cannot support such keys in indices, we might still use them in module names and tools like modinfo. Signed-off-by: Tobias Stoeckmann <[email protected]>
1 parent 3f8f288 commit 9803c44

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

shared/hash.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ static inline unsigned int hash_superfast(const char *key, unsigned int len)
9494
case 3:
9595
hash += get_unaligned((uint16_t *)key);
9696
hash ^= hash << 16;
97-
hash ^= key[2] << 18;
97+
hash ^= ((uint8_t)key[2]) << 18;
9898
hash += hash >> 11;
9999
break;
100100

0 commit comments

Comments
 (0)