[PATCH] lib: sbi_domain: reject zero-size and overflowing ranges in sbi_domain_check_addr_range

Troy Mitchell troy.mitchell at linux.spacemit.com
Mon Jun 8 02:02:58 PDT 2026


On Wed, Apr 22, 2026 at 23:17:50 CST, liutong wrote:
> `max = addr + size` is computed without overflow detection, and a
> size of zero is not rejected. In both cases the `while (addr < max)`
> loop executes zero times and the function falls through to
> `return true` without actually checking any region against the
> domain configuration.
> 
> Reject size == 0 and detect unsigned overflow of addr + size before
> entering the loop.
> 
> Fixes: eab48c33a12d ("lib: sbi: Add sbi_domain_check_addr_range() function")
> Signed-off-by: liutong <liutong at iscas.ac.cn>
Thanks.

Reviewed-by: Troy Mitchell <troy.mitchell at linux.spacemit.com>



More information about the opensbi mailing list