[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v2] xen/page_alloc: Remove dead code in alloc_domheap_pages()

Hi Jan,

On 27/05/2021 08:15, Jan Beulich wrote:
On 26.05.2021 18:11, Julien Grall wrote:
From: Julien Grall <jgrall@xxxxxxxxxx>

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@xxxxxxxxxx>

     Changes in v2:
         - Remove BUILD_BUG_ON()
         - Switch from min_t() to min()

Since this fulfills the dependencies put in place at the time, the
Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx>
continues to apply here. Thanks for making the adjustments.

Thanks for the review. It is now committed.


Julien Grall



Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.