IOMMU UAPI data size is filled by the user space which must be validated by the kernel. To ensure backward compatibility, user data can only be extended by either re-purpose padding bytes or extend the variable sized union at the end. No size change is allowed before the union. Therefore, the minimum size is the offset of the union. To use offsetof() on the union, we must make it named.
Showing the changes to include/uapi (1 of 3 files). Show all
Unified · Split
| @@ -267,7 +267,7 @@ struct iommu_cache_invalidate_info { · 266 unmodified lines | |||
| 267 | union { | 267 | union { |
| 268 | struct iommu_inv_pasid_info pasid_info; | 268 | struct iommu_inv_pasid_info pasid_info; |
| 269 | struct iommu_inv_addr_info addr_info; | 269 | struct iommu_inv_addr_info addr_info; |
| 270 | }; | 270 | } granu; |
| 271 | }; | 271 | }; |
| 272 | 272 | ||
| 273 | /** | 273 | /** |
| @@ -333,7 +333,7 @@ struct iommu_gpasid_bind_data { · 59 unmodified lines | |||
| 333 | /* Vendor specific data */ | 333 | /* Vendor specific data */ |
| 334 | union { | 334 | union { |
| 335 | struct iommu_gpasid_bind_data_vtd vtd; | 335 | struct iommu_gpasid_bind_data_vtd vtd; |
| 336 | }; | 336 | } vendor; |
| 337 | }; | 337 | }; |
| 338 | 338 | ||
| 339 | #endif /* _UAPI_IOMMU_H */ | 339 | #endif /* _UAPI_IOMMU_H */ |