Re: [PATCH 2/3] iommufd: Add check on user response code
From: Jason Gunthorpe
Date: Fri Jul 12 2024 - 08:43:24 EST
On Fri, Jul 12, 2024 at 10:54:11AM +0800, Baolu Lu wrote:
> diff --git a/drivers/iommu/iommufd/fault.c b/drivers/iommu/iommufd/fault.c
> index 29f522819759..a643d5c7c535 100644
> --- a/drivers/iommu/iommufd/fault.c
> +++ b/drivers/iommu/iommufd/fault.c
> @@ -305,10 +305,10 @@ static ssize_t iommufd_fault_fops_write(struct file
> *filep, const char __user *b
> if (rc)
> break;
>
> - static_assert(IOMMUFD_PAGE_RESP_SUCCESS ==
> - IOMMU_PAGE_RESP_SUCCESS);
> - static_assert(IOMMUFD_PAGE_RESP_INVALID ==
> - IOMMU_PAGE_RESP_INVALID);
> + static_assert((int)IOMMUFD_PAGE_RESP_SUCCESS ==
> + (int)IOMMU_PAGE_RESP_SUCCESS);
> + static_assert((int)IOMMUFD_PAGE_RESP_INVALID ==
> + (int)IOMMU_PAGE_RESP_INVALID);
> if (response.code != IOMMUFD_PAGE_RESP_SUCCESS &&
> response.code != IOMMUFD_PAGE_RESP_INVALID) {
> rc = -EINVAL;
Yep, my compiler doesn't warn on that apparently..
Jason