From f26835b4bd2bd37aaf865882f0cc1bec0b66c118 Mon Sep 17 00:00:00 2001 From: Dan Carpenter Date: Mon, 2 Aug 2010 11:44:29 +0200 Subject: [PATCH] buf_size: I broke initializer handling by mistake The zero case here was supposed to fall through and be handled later in the function. Signed-off-by: Dan Carpenter --- smatch_buf_size.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/smatch_buf_size.c b/smatch_buf_size.c index f24a5830..ac0acdbc 100644 --- a/smatch_buf_size.c +++ b/smatch_buf_size.c @@ -100,16 +100,14 @@ int get_array_size(struct expression *expr) if (tmp->type == SYM_ARRAY) { ret = get_expression_value(tmp->array_size); - /* - * Dynamically sized arrays are -1 because sparse doesn't like - * them. People put zero sized arrays on the end of structs. - * Or some people use one element arrays instead of pointers. - * (don't ask me why...) - * - */ - if (ret <= 1) + /* Dynamically sized array are -1 in sparse */ + if (ret < 0) return 0; - return ret * cast_ratio; + /* People put one element arrays on the end of structs */ + if (ret == 1) + return 0; + if (ret) + return ret * cast_ratio; } state = get_state_expr(my_size_id, expr); -- 2.11.4.GIT