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

Troy Mitchell <[email protected]> Mon, 8 Jun 2026 17:02:58 +0800
Newsgroups org.infradead.lists.opensbi
Message-ID <[email protected]>
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 <[email protected]>
Thanks.

Reviewed-by: Troy Mitchell <[email protected]>

-- 
opensbi mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/opensbi