Re: [PATCH v17 04/10] fs/ntfs3: Add file operations and implementation

Matthew Wilcox
2021-01-03T22:06:47Z

On Sun, Jan 03, 2021 at 11:57:32PM +0200, Kari Argillander wrote:
> > + /*
> > + * mirror of len, but signed, because run_packed_size()
> > + * works with signed int only
> > + */
> > + len64 = len;
> > +
> > + /* how much bytes is packed len64 */
> > + size_size = run_packed_size(&len64);
>
> Does (s64 *)&len work just fine?

No. run_packed_size() is going to load/store eight bytes to/from that
pointer. You can't just cast a pointer to a different size and expect
it to work (it might happen to work, particularly on little-endian,
but big-endian is going to get completely the wrong value).