From 3b0b0f7201dbb0bd5a1e9ad4d47bbb6a94fc7f67 Mon Sep 17 00:00:00 2001 From: Dan Carpenter Date: Wed, 6 Feb 2013 21:23:40 +0300 Subject: [PATCH] buf_size: don't crash on invalid code The code which triggers this can't compile, but I spent some time figuring out why Smatch crashed so now I'm committing this change. Signed-off-by: Dan Carpenter --- smatch_buf_size.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/smatch_buf_size.c b/smatch_buf_size.c index 8fa54165..cab2de20 100644 --- a/smatch_buf_size.c +++ b/smatch_buf_size.c @@ -211,7 +211,7 @@ static int get_real_array_size(struct expression *expr) static int get_size_from_initializer(struct expression *expr) { - if (expr->type != EXPR_SYMBOL || !expr->symbol->initializer) + if (expr->type != EXPR_SYMBOL || !expr->symbol || !expr->symbol->initializer) return 0; if (expr->symbol->initializer == expr) /* int a = a; */ return 0; -- 2.11.4.GIT