public inbox for smatch@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Check for NULL stmt in check_all_func_returns
@ 2020-05-12 13:23 john.levon
  2020-05-12 14:08 ` Dan Carpenter
  0 siblings, 1 reply; 2+ messages in thread
From: john.levon @ 2020-05-12 13:23 UTC (permalink / raw)
  To: smatch; +Cc: John Levon, Toomas Soome

From: John Levon <john.levon@joyent.com>

Sometimes, there's nothing on the statement stack.

Signed-off-by: John Levon <john.levon@joyent.com>
Suggested-by: Toomas Soome <tsoome@me.com>
---
 check_all_func_returns.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/check_all_func_returns.c b/check_all_func_returns.c
index f9d77449..1ff50433 100644
--- a/check_all_func_returns.c
+++ b/check_all_func_returns.c
@@ -74,7 +74,7 @@ static void check_func_return(struct expression *expr)
 
 	stmt = last_ptr_list((struct ptr_list *)big_statement_stack);
 
-	if (stmt->type == STMT_EXPRESSION && stmt->expression == expr)
+	if (stmt && stmt->type == STMT_EXPRESSION && stmt->expression == expr)
 		sm_error("unchecked function return '%s'", expr_to_str(expr->fn));
 }
 
-- 
2.23.0

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-05-12 14:11 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-05-12 13:23 [PATCH] Check for NULL stmt in check_all_func_returns john.levon
2020-05-12 14:08 ` Dan Carpenter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox