Re: [PATCH] dma/idxd: Remove __packed from structures
From: Andy Shevchenko
Date: Thu Mar 20 2025 - 11:47:01 EST
On Thu, Mar 20, 2025 at 08:22:39AM -0700, Dave Jiang wrote:
> On 3/20/25 1:18 AM, Yi Sun wrote:
> > The __packed attribute introduces potential unaligned memory accesses
> > and endianness portability issues. Instead of relying on compiler-specific
> > packing, it's much better to explicitly fill structure gaps using padding
> > fields, ensuring natural alignment.
> >
> > Since all previously __packed structures already enforce proper alignment
> > through manual padding, the __packed qualifiers are unnecessary and can be
> > safely removed.
>
> Although endian portability is probably not a concern given this driver is
> only for an Intel platform device.
The concern is that somebody, while writing a code for a non-Intel platform,
might take it as an example and do suboptimal or wrong things.
> Reviewed-by: Dave Jiang <dave.jiang@xxxxxxxxx>
Thanks!
--
With Best Regards,
Andy Shevchenko