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: <67324adb-d9bc-03f6-6ec7-1463a2f35474@arm.com>
Date:   Fri, 14 Jun 2019 11:42:54 +0100
From:   Robin Murphy <robin.murphy@....com>
To:     Christoph Hellwig <hch@....de>,
        Nicolin Chen <nicoleotsuka@...il.com>
Cc:     joro@...tes.org, iommu@...ts.linux-foundation.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH] iommu/dma: Apply dma_{alloc,free}_contiguous functions

On 06/06/2019 07:28, Christoph Hellwig wrote:
> Looks fine to me.  Robin, any comments?

AFAICS this looks like the obvious conversion, so... no? :)

> On Mon, Jun 03, 2019 at 03:52:59PM -0700, Nicolin Chen wrote:
>> This patch replaces dma_{alloc,release}_from_contiguous() with
>> dma_{alloc,free}_contiguous() to simplify those function calls.

Acked-by: Robin Murphy <robin.murphy@....com>

>> Signed-off-by: Nicolin Chen <nicoleotsuka@...il.com>
>> ---
>>   drivers/iommu/dma-iommu.c | 14 ++++----------
>>   1 file changed, 4 insertions(+), 10 deletions(-)
>>
>> diff --git a/drivers/iommu/dma-iommu.c b/drivers/iommu/dma-iommu.c
>> index 0cd49c2d3770..cc3d39dbbe1a 100644
>> --- a/drivers/iommu/dma-iommu.c
>> +++ b/drivers/iommu/dma-iommu.c
>> @@ -951,8 +951,8 @@ static void __iommu_dma_free(struct device *dev, size_t size, void *cpu_addr)
>>   
>>   	if (pages)
>>   		__iommu_dma_free_pages(pages, count);
>> -	if (page && !dma_release_from_contiguous(dev, page, count))
>> -		__free_pages(page, get_order(alloc_size));
>> +	if (page)
>> +		dma_free_contiguous(dev, page, alloc_size);
>>   }
>>   
>>   static void iommu_dma_free(struct device *dev, size_t size, void *cpu_addr,
>> @@ -970,12 +970,7 @@ static void *iommu_dma_alloc_pages(struct device *dev, size_t size,
>>   	struct page *page = NULL;
>>   	void *cpu_addr;
>>   
>> -	if (gfpflags_allow_blocking(gfp))
>> -		page = dma_alloc_from_contiguous(dev, alloc_size >> PAGE_SHIFT,
>> -						 get_order(alloc_size),
>> -						 gfp & __GFP_NOWARN);
>> -	if (!page)
>> -		page = alloc_pages(gfp, get_order(alloc_size));
>> +	page = dma_alloc_contiguous(dev, alloc_size, gfp);
>>   	if (!page)
>>   		return NULL;
>>   
>> @@ -997,8 +992,7 @@ static void *iommu_dma_alloc_pages(struct device *dev, size_t size,
>>   	memset(cpu_addr, 0, alloc_size);
>>   	return cpu_addr;
>>   out_free_pages:
>> -	if (!dma_release_from_contiguous(dev, page, alloc_size >> PAGE_SHIFT))
>> -		__free_pages(page, get_order(alloc_size));
>> +	dma_free_contiguous(dev, page, alloc_size);
>>   	return NULL;
>>   }
>>   
>> -- 
>> 2.17.1
> ---end quoted text---
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ