[PATCH 2/3] dtc: Add data_append_literal function

Anton Staaf robotboy at google.com
Sat Sep 24 03:02:00 EST 2011


On Thu, Sep 22, 2011 at 8:25 PM, Anton Staaf <robotboy at google.com> wrote:
> On Thu, Sep 22, 2011 at 5:13 PM, David Gibson
> <david at gibson.dropbear.id.au> wrote:
>> On Thu, Sep 22, 2011 at 10:57:58AM -0700, Anton Staaf wrote:
>>> On Wed, Sep 21, 2011 at 7:33 PM, David Gibson
>>> <david at gibson.dropbear.id.au> wrote:
>>> > On Wed, Sep 21, 2011 at 01:42:10PM -0700, Anton Staaf wrote:
>> [snip]
>>> >> +
>>> >> +     if ((len < 64) && (value >= (1ULL << len)))
>>> >> +             die("Literal value 0x%x too large to fit in %d-bit cell\n",
>>> >> +                 value, len);
>>> >
>>> > This really shouldn't be a die().  In general bad input should not
>>> > directly trigger a die() during parse - it should give an error but
>>> > continue parse as best it can and only drop out afterwards.
>>>
>>> Hmm, so this check should never happen when called from the
>>> parser because the parser uses eval_literal to read the cell values
>>> and that function also checks this.
>>
>> Um.. it checks and prints an error, but it doesn't die() or otherwise
>> stop you from reaching here AFAICT.
>
> Hah, yes, you are correct.  The same is true for the other die as well
> then I think.
>
> I'll take a closer look tomorrow.

Yup, you're right, first die has to go, second die can stay because I am forcing
the size to a valid size (32-bits) in the parser.

Thanks again,
    Anton

> Thanks,
>    Anton
>
>> --
>> David Gibson                    | I'll have my music baroque, and my code
>> david AT gibson.dropbear.id.au  | minimalist, thank you.  NOT _the_ _other_
>>                                | _way_ _around_!
>> http://www.ozlabs.org/~dgibson
>>
>


More information about the devicetree-discuss mailing list