]> sourceware.org Git - lvm2.git/commitdiff
Fix hash function to avoid using a negative array offset.
authorAlasdair Kergon <agk@redhat.com>
Mon, 9 Jan 2006 20:35:24 +0000 (20:35 +0000)
committerAlasdair Kergon <agk@redhat.com>
Mon, 9 Jan 2006 20:35:24 +0000 (20:35 +0000)
WHATS_NEW_DM
libdm/datastruct/hash.c

index 12e602f52ff1214fa4e12754f5f0941474639848..6e74c4e83a800b42b1f900b9931dff8af40d8648 100644 (file)
@@ -1,5 +1,6 @@
 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.
   Fix libdevmapper.h #endif.
   Fix dmsetup version driver version.
index f986893677f60377e59979d8079a67c98664b308..1a3ea816720655537c854c57f9435cc71524cf30 100644 (file)
@@ -68,14 +68,14 @@ static struct dm_hash_node *_create_node(const char *str, unsigned len)
        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 i;
 
        for (i = 0; i < len; i++) {
                h <<= 4;
-               h += _nums[(int) *str++];
+               h += _nums[*str++];
                g = h & ((unsigned long) 0xf << 16u);
                if (g) {
                        h ^= g >> 16u;
This page took 0.036155 seconds and 5 git commands to generate.