Re: [PATCH v1 03/16] iommu: Add iommu_copy_struct_to_user helper

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> On Apr 11, 2025, at 1:37 AM, Nicolin Chen <nicolinc@xxxxxxxxxx> wrote:
> +__iommu_copy_struct_to_user(const struct iommu_user_data *dst_data,
> +    void *src_data, unsigned int data_type,
> +    size_t data_len, size_t min_len)
> +{
> + if (dst_data->type != data_type)
> + return -EINVAL;
> + if (WARN_ON(!dst_data || !src_data))
> + return -EINVAL;

The NULL pointer check should be first.


-matt





[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux