Re: [PATCH v2 1/2] dm array: validate array block headers on read

Bryam Vargas <[email protected]>
Newsgroups dev.linux.lists.dm-devel,org.kernel.vger.linux-kernel
Message-ID <[email protected]>
On Mon, Aug 03, 2026 at 09:41:36PM +0800, Ming-Hung Tsai wrote:
> One minor nit, which needn't hold up the patch: I'd drop "wanted %u"
> from the error message. The wanted value is derivable from value_size,
> so printing "%s failed: max_entries %u invalid for value_size %u"
> carries the same information.

I'd keep it. The two DMERR_LIMITs above it in array_block_check() are
"blocknr %llu != wanted %llu" and "csum %u != wanted %u", so "%u != wanted
%u" is the shape a reader of this function already expects. You're right
that the wanted value follows from value_size here and doesn't there --
what I was matching is the form, not the information content. Mikulas,
drop it when applying if you'd rather.

> Reproducer to validate the BUG_ON prevention using crafted metadata:
> create a cache device, and reduce the max_entries of the final array
> block of the mapping array. Next, expand the fast device to make the
> last array block exceeds its capacity, which triggers the BUG_ON in
> fill_ablock().

That is the path the equality test is there for -- an upper bound lets a
short max_entries through to fill_ablock() untouched. My A/B covered the
overread only, so that half was by inspection.

Thanks for the review.

Bryam
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.