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

Re: [PATCH 3/5] libxg: drop dead assignment to "ptes" from xc_core_arch_map_p2m_list_rw()


  • To: Anthony PERARD <anthony.perard@xxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Tue, 13 Jun 2023 18:08:16 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=OM9lwbqIpER4R9ogt0cDMHR4kIE5JyHL1Jop51j+1vg=; b=TKLx/18fBXmHnnuI1eFfjE9WF3XQzwENLJZFnheoUR3t+zZ9pRGs42P9wDXc0QeNVkiMm+Y9xRaSIPPOCLEdsRGkye2sVmnAhtpiNcvZbnhBEHtNZb6pPJIM1K6bkWscyQOT7YVAZXif6jzJflbK+vaLHs6xa7SGsLK2fFehqGOE8EwR8lKz4wurtac/jQQArpNTmBuyl6RWibBCLETKcUPjg9EUYIGazyCcHN8CyaLGc1dM/I806EiS/MRhFKxGKXzGB8YBKidnWuohbrsEjZpzsYVOAcrMtKKNRWWv2TpvniUk+XE7JsCtU/U7/9deTpTNC3xEPOPf7yJiQZADUA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=M+mUz+m/icLi6soH5rd5PH8cp/014fTkp//Qd3dLcr2jedrdAVUUyGMXGCncEXH6uYHO4PKlO8QX6Wqsxtvf/CBmE0xvB7sbKThVtxp1V62EmtSQ8YCS/0gDYHGXMvsx0vlCK4b3q0PMB/nhO9xHmbeyl/MW+HTYUz1Vg5MHDZt2iuBs84BwoRKHYQMahJ7AWvgII1v8XLAWWjj6/wznjnGfOt+tL+QVWreb+i07SFoeQ41s/bIM0EMBg42eDlSEKUSZ9sOR2kS68BeLTDHexP4zRLTBVNKWNfFw9qO+DGD5Hnt/GvHjxLyaSa4MjalY6Hhw6YwzfdMWj70RzdJ81Q==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Juergen Gross <jgross@xxxxxxxx>
  • Delivery-date: Tue, 13 Jun 2023 16:08:37 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 13.06.2023 18:03, Anthony PERARD wrote:
> 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 <jbeulich@xxxxxxxx>
>>
>> --- 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().

Imo it would be at that time when the assignment wants (re)adding. I
fully agree with the tool, and I expect Misra (if it was applied to
the tool stack as well) would demand the very same change.

Jan



 


Rackspace

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