[Crash-utility] [PATCH v3 4/4] Add assert check if an element is installed one more time

Tao Liu ltao at redhat.com
Tue Sep 14 09:01:54 UTC 2021


symname_hash_install won't check if spn has been installed before. If
it does, the second install will corrupt the hash table as well as
spn->cnt counting. It should never happen in normal cases, but we need
get notified if it happens.

Signed-off-by: Tao Liu <ltao at redhat.com>
---
 symbols.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/symbols.c b/symbols.c
index f8b4998..a453a6a 100644
--- a/symbols.c
+++ b/symbols.c
@@ -1167,6 +1167,7 @@ symname_hash_install(struct syment *table[], struct syment *spn)
 		spn->name_hash_next = NULL;
 	} else {
 		while (sp) {
+			assert(sp != spn);
 	        	if (STREQ(sp->name, spn->name)) {
 	                	sp->cnt++;
 	                	spn->cnt++;
-- 
2.29.2




More information about the Crash-utility mailing list