[prev in list] [next in list] [prev in thread] [next in thread] 

List:       linux-sparse
Subject:    Re: [PATCH] Fix offsets in anonymous unions
From:       Christopher Li <sparse () chrisli ! org>
Date:       2014-06-01 7:55:44
Message-ID: CANeU7Qn067TkgFsfHJkd30Q3mEtCvgjwMUt=a3Yfo7Zfcq10fg () mail ! gmail ! com
[Download RAW message or body]

On Thu, May 22, 2014 at 6:22 AM, John Keeping <john@keeping.me.uk> wrote:
> Commit 38d1124 (Fix error at anoymous unions, 2014-04-03) says:
> @@ -2328,6 +2326,7 @@ static struct expression *check_designators(struct expression *e,
>                                 break;
>                         }
>                         e->field = e->ctype = ctype;
> +                       e->init_offset = offset;
>                         last = e;
>                         if (!e->ident_expression) {

OK, this is actually wrong. The member "init_offset" is only
valid for EXPR_POS type. The current e->type is EXPR_IDENTIFIER,
the e->init_offset member actually share the same memory location as
e->expr_ident. In order words, writing to init_offset will corrupt the
e->expr_ident. We did not use e->expr_ident afterwards though.


Chris
--
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic