[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4b17d331-957b-44d3-8a19-0b2ccc59150b@linux.intel.com>
Date: Thu, 21 Sep 2023 20:10:58 +0800
From: Baolu Lu <baolu.lu@...ux.intel.com>
To: Yi Liu <yi.l.liu@...el.com>, joro@...tes.org,
alex.williamson@...hat.com, jgg@...dia.com, kevin.tian@...el.com,
robin.murphy@....com
Cc: baolu.lu@...ux.intel.com, cohuck@...hat.com, eric.auger@...hat.com,
nicolinc@...dia.com, kvm@...r.kernel.org, mjrosato@...ux.ibm.com,
chao.p.peng@...ux.intel.com, yi.y.sun@...ux.intel.com,
peterx@...hat.com, jasowang@...hat.com,
shameerali.kolothum.thodi@...wei.com, lulu@...hat.com,
suravee.suthikulpanit@....com, iommu@...ts.linux.dev,
linux-kernel@...r.kernel.org, linux-kselftest@...r.kernel.org,
zhenzhong.duan@...el.com, joao.m.martins@...cle.com
Subject: Re: [PATCH v4 01/17] iommu: Add hwpt_type with user_data for
domain_alloc_user op
On 2023/9/21 15:51, Yi Liu wrote:
> +/**
> + * iommu_copy_user_data - Copy iommu driver specific user space data
> + * @dst_data: Pointer to an iommu driver specific user data that is defined in
> + * include/uapi/linux/iommufd.h
> + * @src_data: Pointer to a struct iommu_user_data for user space data info
> + * @data_len: Length of current user data structure, i.e. sizeof(struct _dst)
> + * @min_len: Initial length of user data structure for backward compatibility.
> + * This should be offsetofend using the last member in the user data
> + * struct that was initially added to include/uapi/linux/iommufd.h
> + */
> +static inline int iommu_copy_user_data(void *dst_data,
> + const struct iommu_user_data *src_data,
> + size_t data_len, size_t min_len)
> +{
> + if (WARN_ON(!dst_data || !src_data))
> + return -EINVAL;
> + if (src_data->len < min_len || data_len < src_data->len)
> + return -EINVAL;
> + return copy_struct_from_user(dst_data, data_len,
> + src_data->uptr, src_data->len);
> +}
I am not sure that I understand the purpose of "min_len" correctly. It
seems like it would always be equal to data_len?
Or, it means the minimal data length that the iommu driver requires?
Best regards,
baolu
Powered by blists - more mailing lists