Re: [PATCH] fscrypt: Avoid dynamic allocation in fscrypt_get_devices()

From: Christoph Hellwig

Date: Mon Jul 20 2026 - 05:27:03 EST


On Sat, Jul 18, 2026 at 10:56:02PM -0700, Eric Biggers wrote:
> For now, let's fix this in the straightforward and easily-backportable
> way by switching to an on-stack array. Currently the fscrypt
> multi-device functionality is used only by f2fs, which has a hardcoded
> limit of 8 block devices. An on-stack array works fine for that.

Looks fine as a quick fix:

Reviewed-by: Christoph Hellwig <hch@xxxxxx>

> (Of course, this solution won't scale up to large number of block
> devices. For that we'd need a different solution, like moving the block
> device iteration into the filesystem.

I'd love to see this happen rather sooner than later, as that's a much
better architecture.