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

Michael Shavit mshavit at google.com
Thu Aug 31 11:38:28 PDT 2023


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.


More information about the Toybox mailing list