[PATCH] check_freeing_devm: Report the correct function name that triggered the warning

Christophe JAILLET <[email protected]> Thu, 26 May 2022 08:44:39 +0200
Newsgroups org.kernel.vger.smatch
Message-ID <7e4e1d104bd25fc823764c7914435d14fe34d2c6.1653547466.git.christophe.jaillet@wanadoo.fr>
The warning message has a hard-coded 'kfree' but another function can
trigger this warning.
So, report the correct function name to be less puzzling.

Signed-off-by: Christophe JAILLET <[email protected]>
---
 check_freeing_devm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/check_freeing_devm.c b/check_freeing_devm.c
index 02587bcf5d8c..b6f639161ad8 100644
--- a/check_freeing_devm.c
+++ b/check_freeing_devm.c
@@ -36,7 +36,7 @@ static void match_free_func(const char *fn, struct expression *expr, void *_arg)
 	if (!get_state_expr(my_id, arg_expr))
 		return;
 	name = expr_to_str(arg_expr);
-	sm_warning("passing devm_ allocated variable to kfree. '%s'", name);
+	sm_warning("passing devm_ allocated variable to %s. '%s'", fn, name);
 	free_string(name);
 }
 
-- 
2.34.1