Re: [PATCH] arm: dma-mapping: fix potential endless loop in __dma_page_dev_to_cpu()

From: Marek Szyprowski
Date: Wed Aug 09 2023 - 13:05:28 EST


Hi,

On 07.08.2023 18:23, Matthew Wilcox wrote:
> On Mon, Aug 07, 2023 at 05:26:57PM +0200, Marek Szyprowski wrote:
>> It is possible that the folio_size() of the next folio returns zero, so
> What? How can folio_size() return zero?
>
> return PAGE_SIZE << folio_order(folio);
>
> It is a minimum of PAGE_SIZE.

Well, the folio_order() on that next folio returns 255, so folio_size()
overflows to zero. However, the main source of this issue is relying on
the properties of the folio beyond the requested sync region.

> ...

Best regards
--
Marek Szyprowski, PhD
Samsung R&D Institute Poland