Re: Coverity: zblock_alloc(): Memory - illegal accesses

From: Ananda Badmaev
Date: Fri Nov 18 2022 - 14:44:48 EST


18.11.2022 19:43, Kees Cook пишет:
Ah-ha, understood. Well, if you do want to catch it if there is ever a
typo in the block_desc values (which are not obviously >4096 without
sitting down and calculating them), perhaps add:

if (WARN_ON(block_type >= ARRAY_SIZE(block_desc))
return -ENOSPC;



Probably it would be better to add a single check on the largest slot_size >= PAGE_SIZE at pool creation time.