Re: [PATCH] swiotlb: Initialise restricted pool list_head when SWIOTLB_DYNAMIC=y

From: Petr Tesařík
Date: Sat May 04 2024 - 05:02:33 EST


On Thu, 2 May 2024 14:56:01 +0200
Christoph Hellwig <hch@xxxxxx> wrote:

> Thanks,
>
> applied to the dma-mapping for-linus branch.
>
> I plan to send it to Linus this weekend unless someone find a grave bug
> in this pretty obvious one liner.

Thank you, and big thanks to Will for the fix!

Yes, the fix is obviously correct. During development, the pool list was
never dereferenced when mem->can_grow was false, but I forgot to add
the initialization when I optimized away the check for can_grow.

BTW this mem->can_grow flag is also why mem->dyn_alloc can be left
uninitialized, but now I wonder if it should be initialized even though
it's unused, just to make the code more robust in case of future
changes.

Petr T