[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190726063025.GF22881@lst.de>
Date: Fri, 26 Jul 2019 08:30:25 +0200
From: Christoph Hellwig <hch@....de>
To: Nicolin Chen <nicoleotsuka@...il.com>
Cc: dafna.hirschfeld@...labora.com, hch@....de,
m.szyprowski@...sung.com, robin.murphy@....com,
iommu@...ts.linux-foundation.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 2/2] dma-contiguous: page-align the size in
dma_free_contiguous()
On Thu, Jul 25, 2019 at 04:39:59PM -0700, Nicolin Chen wrote:
> According to the original dma_direct_alloc_pages() code:
> {
> unsigned int count = PAGE_ALIGN(size) >> PAGE_SHIFT;
>
> if (!dma_release_from_contiguous(dev, page, count))
> __free_pages(page, get_order(size));
> }
>
> The count parameter for dma_release_from_contiguous() was page
> aligned before the right-shifting operation, while the new API
> dma_free_contiguous() forgets to have PAGE_ALIGN() at the size.
>
> So this patch simply adds it to prevent any corner case.
>
> Fixes: fdaeec198ada ("dma-contiguous: add dma_{alloc,free}_contiguous() helpers")
> Signed-off-by: Nicolin Chen <nicoleotsuka@...il.com>
Looks good,
Reviewed-by: Christoph Hellwig <hch@....de>
Powered by blists - more mailing lists