On Mon, Oct 23, 2023 at 10:28:13AM +0100, Joao Martins wrote: > > so it's probably > > best to add a range check plus type cast, rather than an > > expensive div_u64() here. > > OK Just keep it simple, we don't need to optimize for 32 bit. div_u64 will make the compiler happy. > >> +struct iommu_hwpt_get_dirty_bitmap { > >> + __u32 size; > >> + __u32 hwpt_id; > >> + __u32 flags; > >> + __u32 __reserved; > >> + __aligned_u64 iova; > >> + __aligned_u64 length; > >> + __aligned_u64 page_size; > >> + __aligned_u64 *data; > >> +}; > >> +#define IOMMU_HWPT_GET_DIRTY_BITMAP _IO(IOMMUFD_TYPE, \ > >> + IOMMUFD_CMD_HWPT_GET_DIRTY_BITMAP) > >> + > > > > This is a flawed definition for an ioctl data structure. While > > it appears that you have tried hard to follow the recommendations > > in Documentation/driver-api/ioctl.rst, you accidentally added > > a pointer here, which breaks compat mode handling because of > > the uninitialized padding after the 32-bit 'data' pointer. > > > Right oops how did we all miss that extra character :| Jason