lkml.org 
[lkml]   [2023]   [Sep]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH v4 01/17] iommu: Add hwpt_type with user_data for domain_alloc_user op
From
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

\
 
 \ /
  Last update: 2023-09-21 21:54    [W:0.346 / U:1.660 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site