From 8877528efb8b9bff1a45af0bee1a61753538e2fe Mon Sep 17 00:00:00 2001 From: Dan Carpenter Date: Thu, 2 Apr 2009 22:34:49 +0300 Subject: [PATCH] Add the allocation funcs. Signed-off-by: Dan Carpenter --- check_null_deref.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/check_null_deref.c b/check_null_deref.c index c8b67f67..71d2748e 100644 --- a/check_null_deref.c +++ b/check_null_deref.c @@ -421,6 +421,28 @@ static void end_file_processing(void) } END_FOR_EACH_PTR(param1); } +static void register_allocation_funcs(void) +{ + struct token *token; + const char *func; + + token = get_tokens_file("kernel.allocation_funcs"); + if (!token) + return; + if (token_type(token) != TOKEN_STREAMBEGIN) + return; + token = token->next; + while (token_type(token) != TOKEN_STREAMEND) { + if (token_type(token) != TOKEN_IDENT) + return; + func = show_ident(token->ident); + add_function_assign_hook(func, &match_assign_returns_null, + NULL); + token = token->next; + } + clear_token_alloc(); +} + void check_null_deref(int id) { int i; @@ -440,4 +462,5 @@ void check_null_deref(int id) add_function_assign_hook(return_null[i], &match_assign_returns_null, NULL); } + register_allocation_funcs(); } -- 2.11.4.GIT