mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
Fix hash function to avoid using a negative array offset.
This commit is contained in:
parent
079ac15ece
commit
b6b0c621f6
@ -1,5 +1,6 @@
|
|||||||
Version 1.02.03 -
|
Version 1.02.03 -
|
||||||
============================
|
============================
|
||||||
|
Fix hash function to avoid using a negative array offset.
|
||||||
Don't inline _find in hash.c and tidy signed/unsigned etc.
|
Don't inline _find in hash.c and tidy signed/unsigned etc.
|
||||||
Fix libdevmapper.h #endif.
|
Fix libdevmapper.h #endif.
|
||||||
Fix dmsetup version driver version.
|
Fix dmsetup version driver version.
|
||||||
|
@ -68,14 +68,14 @@ static struct dm_hash_node *_create_node(const char *str, unsigned len)
|
|||||||
return n;
|
return n;
|
||||||
}
|
}
|
||||||
|
|
||||||
static unsigned long _hash(const char *str, unsigned len)
|
static unsigned long _hash(const unsigned char *str, unsigned len)
|
||||||
{
|
{
|
||||||
unsigned long h = 0, g;
|
unsigned long h = 0, g;
|
||||||
unsigned i;
|
unsigned i;
|
||||||
|
|
||||||
for (i = 0; i < len; i++) {
|
for (i = 0; i < len; i++) {
|
||||||
h <<= 4;
|
h <<= 4;
|
||||||
h += _nums[(int) *str++];
|
h += _nums[*str++];
|
||||||
g = h & ((unsigned long) 0xf << 16u);
|
g = h & ((unsigned long) 0xf << 16u);
|
||||||
if (g) {
|
if (g) {
|
||||||
h ^= g >> 16u;
|
h ^= g >> 16u;
|
||||||
|
Loading…
Reference in New Issue
Block a user