From 849481dffff47b5bc27c2954bdc7d29eebd6050c Mon Sep 17 00:00:00 2001 From: Dan Carpenter Date: Mon, 4 Feb 2019 11:24:22 +0300 Subject: [PATCH] address: return unknown if we can't figure out the offset Sometimes we can't figure out the offset, like when we do: &foo[unknown_value]; In that case, then get_address_rl() can't really work and we should return failure. Signed-off-by: Dan Carpenter --- smatch_address.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/smatch_address.c b/smatch_address.c index 5c48e05f..c9750889 100644 --- a/smatch_address.c +++ b/smatch_address.c @@ -225,6 +225,9 @@ int get_address_rl(struct expression *expr, struct range_list **rl) if (unop->type == EXPR_DEREF) { int offset = get_member_offset_from_deref(unop); + if (offset == -1) + return 0; + unop = strip_expr(unop->unop); if (unop->type == EXPR_SYMBOL) { *rl = where_allocated_rl(unop->symbol); -- 2.11.4.GIT