[Toybox] [PATCH] devmem: Fix 8 byte wide writes

Rob Landley rob at landley.net
Thu Aug 31 14:27:24 PDT 2023


On 8/31/23 13:38, Michael Shavit wrote:
> On Thu, Aug 31, 2023 at 8:26 PM Michael Shavit <mshavit at google.com> wrote:
>>
>> On Thu, Aug 31, 2023 at 6:57 PM Rob Landley <rob at landley.net> wrote:
>> >
>> >    // DATA? Report out of range values as errors rather than truncating.
>> > -  if (writing) data = atolx_range(toys.optargs[2], 0, (1ULL<<(8*bytes))-1);
>> > +  if (writing && (data = atollu(toys.optargs[2]))>(~0LL)>>(64-8*bytes))
>>
>> Shouldn't it be (~0ULL)? I think (~0LL) would make this an arithmetic
>> shift instead of a logical shift.
> 
> The `devmem 0x000000008b300000  4 0x1FFFFFFFF` testcase doesn't detect
> and print an error because of this issue. But your change with  (~0LL)
> changed to (~0ULL) does pass all the test cases previously mentioned.

I'm trying to cut and paste your test cases into the git commit message and
don't know how to escape the "lines starting with # will be ignored" bit. :P

Commit ad36c8765d8a

Rob


More information about the Toybox mailing list