signedness bug in 2.1.131:include/linux/dcache.h:full_name_hash

Assar Westerlund (assar@sics.se)
06 Dec 1998 00:35:00 +0100


Hi.

There's a bug from 2.1.61 to 2.1.131 in full_name_hash(). The name
parameter should be of type `unsigned', otherwise negative numbers get
turned into large positive ones when calling partial_name_hash.

Patch appended at the end.

/assar

--- dcache.h~ Wed Dec 2 06:45:10 1998
+++ dcache.h Sun Dec 6 00:14:04 1998
@@ -40,11 +40,11 @@
hash += hash >> 4*sizeof(hash);
return (unsigned int) hash;
}

/* Compute the hash for a name string. */
-static __inline__ unsigned int full_name_hash(const char * name, unsigned int len)
+static __inline__ unsigned int full_name_hash(const unsigned char * name, unsigned int len)
{
unsigned long hash = init_name_hash();
while (len--)
hash = partial_name_hash(*name++, hash);
return end_name_hash(hash);

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/