]> xenbits.xensource.com Git - xen.git/commit
xen/page_alloc: Remove dead code in alloc_domheap_pages()
authorJulien Grall <jgrall@amazon.com>
Mon, 22 Feb 2021 12:01:18 +0000 (12:01 +0000)
committerJulien Grall <jgrall@amazon.com>
Tue, 1 Jun 2021 15:34:50 +0000 (16:34 +0100)
commit5268b2dcf7e5342c8a51ceb4bed3e7740c69f5c1
tree2879fc847d60de9a6d3bc4f54f92eddde2a163be
parent57f68dfd2d111a2ad381df740543c901b41f2299
xen/page_alloc: Remove dead code in alloc_domheap_pages()

Since commit 1aac966e24e9 "xen: support RAM at addresses 0 and 4096",
bits_to_zone() will never return 0 and it is expected that we have
minimum 2 zones.

Therefore the check in alloc_domheap_pages() is unnecessary and can
be removed. However, for sanity, it is replaced with an ASSERT().

Also take the opportunity to switch from min_t() to min() as
bits_to_zone() cannot return a negative value. The macro is tweaked
to make it clearer.

This bug was discovered and resolved using Coverity Static Analysis
Security Testing (SAST) by Synopsys, Inc.

Signed-off-by: Julien Grall <jgrall@amazon.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
xen/common/page_alloc.c