On Thu, Sep 21, 2023 at 01:58:19PM -0700, Nicolin Chen wrote: > Perhaps we could put all min_len defines in uAPI header, like: > include/uapi/linux/gfs2_ondisk.h:442:#define LH_V1_SIZE (offsetofend(struct gfs2_log_header, lh_hash)) > In this way, drivers won't need to deal with that nor have risks > of breaking ABI by changing a min_len. I don't think we need constants, just be sure that every call to iommu_copy_user_data() has an offsetof() as the last parameter. Indeed perhaps you should put it in a macro and force this to happen eg: #define iommu_copy_user_data(user_data, from, min_size_member) \ __iommu_copy_user_data(user_data, from, offsetofend(typeof(*from), min_size_member)) iommu_copy_user_data(user_data, &data, iotlb); Jason