Re: [PATCH] fix expansion of constant bitfield dereference

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, Aug 20, 2017 at 6:16 PM, Luc Van Oostenryck
<luc.vanoostenryck@xxxxxxxxx> wrote:
> During the expansion of a dereference, it's if the initializer
> which corrrespond to the offset we're interested is a constant.
> In which case this dereference can be avoided and the value
> given in the initializer can be used instead.
>
> However, it's not enough to check for the offset since for bitfields
> several are placed at the same offset.
> Currently, the first initializer matching the offset is selected.
>
> Fix this by refusing such expansion if the constant value correspond
> to a bitfield.
>

With this applied, sparse still have a bug at did not match the
value to the bit field member, right? I saw on the other email
thread said the value always pick offset zero.

Should I apply this as patch format or wait for it show up in a
git pull request later?


> --- a/expand.c
> +++ b/expand.c
> @@ -644,6 +644,8 @@ static int expand_dereference(struct expression *expr)
>                 if (value) {
>                         /* FIXME! We should check that the size is right! */
>                         if (value->type == EXPR_VALUE) {
> +                               if (is_bitfield_type(value->ctype))
> +                                       return UNSAFE;

You might want to consider move this outside of the EXPR_VALUE.
I assume there is a bug in sparse matching the value to the member
wrong, it could happen to EXPR_FVALUE as well.

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



[Index of Archives]     [Newbies FAQ]     [LKML]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Trinity Fuzzer Tool]

  Powered by Linux