helper: fix crashing bug
authorDan Carpenter <dan.carpenter@oracle.com>
Thu, 12 Sep 2013 09:43:19 +0000 (12 12:43 +0300)
committerDan Carpenter <dan.carpenter@oracle.com>
Thu, 12 Sep 2013 09:43:19 +0000 (12 12:43 +0300)
This has problems parsing unions.  The fix is not very beautiful but it
doesn't make anything worse.

Reported-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
smatch_helper.c

index 7f832f4..93fd0ba 100644 (file)
@@ -122,7 +122,10 @@ static void __get_variable_from_expr(struct symbol **sym_ptr, char *buf,
                else
                        append(buf, ".", len);
 
-               append(buf, expr->member->name, len);
+               if (expr->member && expr->member->name)
+                       append(buf, expr->member->name, len);
+               else
+                       append(buf, "unknown_member", len);
 
                return;
        case EXPR_SYMBOL: