|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [PATCH] x86/mm: Simplify expression in set_gpfn_from_mfn()
On 15.09.2020 19:53, Andrew Cooper wrote:
> Coverity points out that the "d &&" is redundant.
How can it know that ...
> --- a/xen/arch/x86/x86_64/mm.c
> +++ b/xen/arch/x86/x86_64/mm.c
> @@ -1336,7 +1336,7 @@ void set_gpfn_from_mfn(unsigned long mfn, unsigned long
> pfn)
> {
> const struct domain *d = page_get_owner(mfn_to_page(_mfn(mfn)));
>
> - if ( d && (d == dom_cow) )
> + if ( d == dom_cow )
... dom_cow is not NULL (in which case the new expression is wrong
when d also is). I actually think Coverity has spotted the issue
when dom_cow is #define-d to NULL, in which case the original
expression degenerates to "d && !d".
If the purpose of the extra check is more obvious that way, we
could check dom_cow to be non-NULL (instead of d), but I'm afraid
this may not silence Coverity.
Jan
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |