On 02.04.2025 14:56, scan-ad...@coverity.com wrote:
> ** CID 1645573:  Null pointer dereferences  (FORWARD_NULL)
> 
> 
> ________________________________________________________________________________________________________
> *** CID 1645573:  Null pointer dereferences  (FORWARD_NULL)
> /xen/arch/x86/mm/p2m.c: 346 in get_page_from_mfn_and_type()
> 340     
> 341         if ( p2m_is_ram(t) )
> 342         {
> 343             if ( p2m_is_shared(t) )
> 344                 d = dom_cow;
> 345     
>>>>     CID 1645573:  Null pointer dereferences  (FORWARD_NULL)
>>>>     Passing null pointer "d" to "get_page", which dereferences it.
> 346             if ( get_page(page, d) )
> 347                 return page;
> 348         }

I wonder how the tool concludes d is NULL. The only vague guess I could come
up with is that it checks a MEM_SHARING=n build, where dom_cow is always
NULL. Yet in such a build p2m_shared() is also always false. Should we perhaps
help it by forcing P2M_SHARED_TYPES (maybe also P2M_SHARABLE_TYPES) to 0 when
MEM_SHARING=n? We do such already for MEM_PAGING=n ...

Jan

Reply via email to