From: Jan Beulich <jbeulich@suse.com>
To: Anthony PERARD <anthony.perard@citrix.com>
Cc: "xen-devel@lists.xenproject.org" <xen-devel@lists.xenproject.org>,
Wei Liu <wl@xen.org>, Juergen Gross <jgross@suse.com>
Subject: Re: [PATCH 3/5] libxg: drop dead assignment to "ptes" from xc_core_arch_map_p2m_list_rw()
Date: Tue, 13 Jun 2023 18:08:16 +0200 [thread overview]
Message-ID: <a22f00e7-d5e4-45e1-652c-bf22ad78f567@suse.com> (raw)
In-Reply-To: <33566692-ee42-44af-a94a-5535fdf39930@perard>
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@suse.com>
>>
>> --- 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
next prev parent reply other threads:[~2023-06-13 16:08 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-12 11:43 [PATCH 0/5] tools: address Coverity UNUSED issues Jan Beulich
2023-06-12 11:45 ` [PATCH 1/5] xen-mfndump: drop dead assignment to "page" from lookup_pte_func() Jan Beulich
2023-06-12 12:47 ` Jason Andryuk
2023-06-13 15:43 ` Anthony PERARD
2023-06-12 11:46 ` [PATCH 2/5] libxl: drop dead assignments to "ret" from libxl__domain_config_setdefault() Jan Beulich
2023-06-12 12:14 ` Juergen Gross
2023-06-12 19:44 ` Daniel P. Smith
2023-06-12 20:21 ` Daniel P. Smith
2023-06-13 6:33 ` Jan Beulich
2023-06-13 9:21 ` Daniel P. Smith
2023-06-13 9:40 ` Jan Beulich
2023-06-13 9:57 ` Daniel P. Smith
2023-06-13 10:15 ` Jan Beulich
2023-06-13 10:40 ` Daniel P. Smith
2023-06-13 15:51 ` Anthony PERARD
2023-06-12 11:46 ` [PATCH 3/5] libxg: drop dead assignment to "ptes" from xc_core_arch_map_p2m_list_rw() Jan Beulich
2023-06-12 12:16 ` Juergen Gross
2023-06-13 16:03 ` Anthony PERARD
2023-06-13 16:08 ` Jan Beulich [this message]
2023-06-13 16:40 ` Anthony PERARD
2023-06-14 6:34 ` Jan Beulich
2023-06-12 11:47 ` [PATCH 4/5] libxg: drop dead assignment to "rc" from xc_cpuid_apply_policy() Jan Beulich
2023-06-12 12:17 ` Juergen Gross
2023-06-13 16:08 ` Anthony PERARD
2023-06-12 11:47 ` [PATCH 5/5] libxl: drop dead assignment to transaction variable from libxl__domain_make() Jan Beulich
2023-06-12 12:19 ` Juergen Gross
2023-06-13 16:10 ` Anthony PERARD
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=a22f00e7-d5e4-45e1-652c-bf22ad78f567@suse.com \
--to=jbeulich@suse.com \
--cc=anthony.perard@citrix.com \
--cc=jgross@suse.com \
--cc=wl@xen.org \
--cc=xen-devel@lists.xenproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).