[lvc-project] [PATCH] assoc_array: fix the return value in assoc_array_insert_mid_shortcut()

Roman Smirnov r.smirnov at omp.ru
Thu Mar 7 10:17:17 MSK 2024


Returning the edit variable is redundant because it is
dereferenced right before it is returned. It would be better
to return true.

Found by Linux Verification Center (linuxtesting.org) with Svace.

Signed-off-by: Roman Smirnov <r.smirnov at omp.ru>
Reviewed-by: Sergey Shtylyov <s.shtylyov at omp.ru>
---
 lib/assoc_array.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/assoc_array.c b/lib/assoc_array.c
index ca0b4f360c1a..388e656ac974 100644
--- a/lib/assoc_array.c
+++ b/lib/assoc_array.c
@@ -938,7 +938,7 @@ static bool assoc_array_insert_mid_shortcut(struct assoc_array_edit *edit,
 		edit->leaf_p = &new_n0->slots[0];
 
 	pr_devel("<--%s() = ok [split shortcut]\n", __func__);
-	return edit;
+	return true;
 }
 
 /**
-- 
2.34.1




More information about the lvc-project mailing list