On Mon, Jun 12, 2023 at 01:46:40PM +0200, Jan Beulich wrote:
> The function returns immediately after the enclosing if().
> 
> Coverity ID: 1532314
> Fixes: bd7a29c3d0b9 ("tools/libs/ctrl: fix xc_core_arch_map_p2m() to support 
> linear p2m table")
> Signed-off-by: Jan Beulich <[email protected]>
> 
> --- a/tools/libs/guest/xg_core_x86.c
> +++ b/tools/libs/guest/xg_core_x86.c
> @@ -210,7 +210,6 @@ xc_core_arch_map_p2m_list_rw(xc_interfac
>          }
>  
>          munmap(ptes, n_pages * PAGE_SIZE);
> -        ptes = NULL;
>          off = p2m_vaddr & ((mask >> shift) << shift);
>      }

Do we have to remove this assignment? What if someone adds code later
and reuse the content of the variable `ptes`? Or what if someone adds
codes after the loop, and handle an error with `goto out`, we would have
a double-munmap().

-- 
Anthony PERARD

Reply via email to