Re: [RFH] index_name_exists() conversion

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On Thu, 21 Feb 2008, Linus Torvalds wrote:
> 
> (Also, some code used to just reuse the same cache entry multiple times, 
> and that got illegal for the same reason).

Ahh. I think I may have found it.

It's stupid.

In hash_index_entry(), we insert the entry into the name hash, but if it 
got inserted as the first entry, we don't actually set the ->next pointer 
to NULL.

So the chain would end up pointing to some random crud. I think we were 
just lucky with our allocators generally filling those things with zero.

See if this fixes it.

		Linus

---
diff --git a/read-cache.c b/read-cache.c
--- a/read-cache.c
+++ b/read-cache.c
@@ -39,6 +39,7 @@ static void hash_index_entry(struct index_state *istate, struct cache_entry *ce)
 	void **pos;
 	unsigned int hash = hash_name(ce->name, ce_namelen(ce));
 
+	ce->next = NULL;
 	pos = insert_hash(hash, ce, &istate->name_hash);
 	if (pos) {
 		ce->next = *pos;
-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux