lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <c2884c15-b7ee-64f9-3be9-74f4e21e83e9@linux.intel.com>
Date:   Fri, 4 Aug 2023 13:33:33 +0800
From:   Baolu Lu <baolu.lu@...ux.intel.com>
To:     "Tian, Kevin" <kevin.tian@...el.com>,
        Joerg Roedel <joro@...tes.org>, Will Deacon <will@...nel.org>,
        Robin Murphy <robin.murphy@....com>,
        Jason Gunthorpe <jgg@...pe.ca>,
        Jean-Philippe Brucker <jean-philippe@...aro.org>,
        Nicolin Chen <nicolinc@...dia.com>
Cc:     baolu.lu@...ux.intel.com, "Liu, Yi L" <yi.l.liu@...el.com>,
        Jacob Pan <jacob.jun.pan@...ux.intel.com>,
        "iommu@...ts.linux.dev" <iommu@...ts.linux.dev>,
        "kvm@...r.kernel.org" <kvm@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v2 05/12] iommu: Change the return value of
 dev_iommu_get()



On 8/4/23 11:55 AM, Tian, Kevin wrote:
>> From: Baolu Lu<baolu.lu@...ux.intel.com>
>> Sent: Friday, August 4, 2023 11:10 AM
>>
>> On 2023/8/3 15:59, Tian, Kevin wrote:
>>>> From: Lu Baolu<baolu.lu@...ux.intel.com>
>>>> Sent: Thursday, July 27, 2023 1:49 PM
>>>>
>>>> Make dev_iommu_get() return 0 for success and error numbers for failure.
>>>> This will make the code neat and readable. No functionality changes.
>>>>
>>>> Reviewed-by: Jacob Pan<jacob.jun.pan@...ux.intel.com>
>>>> Signed-off-by: Lu Baolu<baolu.lu@...ux.intel.com>
>>>> ---
>>>>    drivers/iommu/iommu.c | 19 +++++++++++--------
>>>>    1 file changed, 11 insertions(+), 8 deletions(-)
>>>>
>>>> diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c
>>>> index 00309f66153b..4ba3bb692993 100644
>>>> --- a/drivers/iommu/iommu.c
>>>> +++ b/drivers/iommu/iommu.c
>>>> @@ -290,20 +290,20 @@ void iommu_device_unregister(struct
>>>> iommu_device *iommu)
>>>>    }
>>>>    EXPORT_SYMBOL_GPL(iommu_device_unregister);
>>>>
>>>> -static struct dev_iommu *dev_iommu_get(struct device *dev)
>>>> +static int dev_iommu_get(struct device *dev)
>>>>    {
>>>>    	struct dev_iommu *param = dev->iommu;
>>>>
>>>>    	if (param)
>>>> -		return param;
>>>> +		return 0;
>>>>
>>>>    	param = kzalloc(sizeof(*param), GFP_KERNEL);
>>>>    	if (!param)
>>>> -		return NULL;
>>>> +		return -ENOMEM;
>>>>
>>>>    	mutex_init(&param->lock);
>>>>    	dev->iommu = param;
>>>> -	return param;
>>>> +	return 0;
>>>>    }
>>>>
>>> Jason's series [1] has been queued. Time to refine according to
>>> the discussion in [2].
>>>
>>> [1]https://lore.kernel.org/linux-iommu/ZLFYXlSBZrlxFpHM@8bytes.org/
>>> [2]https://lore.kernel.org/linux-iommu/c815fa2b-00df-91e1-8353-
>> 8258773957e4@...ux.intel.com/
>>
>> I'm not sure I understand your point here. This only changes the return
>> value of dev_iommu_get() to make the code more concise.
>>
> I thought the purpose of this patch was to prepare for next patch which
> moves dev->fault_param initialization to dev_iommu_get().

Yes.

> 
> with Jason's rework IMHO that initialization more fits in iommu_init_device().
> 
> that's my real point. If you still want to clean up dev_iommu_get() it's fine
> but then it may not belong to this series. 😊

Ah, I see. Let me make a choice in the next version.

Best regards,
baolu

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ