From: Ian Campbell <ian.campbell@citrix.com>
To: ian.jackson@eu.citrix.com, wei.liu2@citrix.com, xen-devel@lists.xen.org
Cc: Ian Campbell <ian.campbell@citrix.com>
Subject: [PATCH] libxenforeignmemory: handle partial failure correctly
Date: Wed, 3 Feb 2016 10:10:01 +0000 [thread overview]
Message-ID: <1454494201-14910-1-git-send-email-ian.campbell@citrix.com> (raw)
Coverity rightly points out that checking for ret == NULL and then
calling osdep unmap(ret) is wrong.
The intention on this code path is to turn partial failure into total
failure when the err argument is NULL, so we want to take this patch
whenever ret is _non_ NULL (and err_to_free is set, indicating err was
NULL).
CID: 1351219
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
---
tools/libs/foreignmemory/core.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/libs/foreignmemory/core.c b/tools/libs/foreignmemory/core.c
index 6591888..a872b95 100644
--- a/tools/libs/foreignmemory/core.c
+++ b/tools/libs/foreignmemory/core.c
@@ -79,7 +79,7 @@ void *xenforeignmemory_map(xenforeignmemory_handle *fmem,
ret = osdep_xenforeignmemory_map(fmem, dom, prot, num, arr, err);
- if ( ret == 0 && err_to_free )
+ if ( ret && err_to_free )
{
int i;
--
2.1.4
next reply other threads:[~2016-02-03 10:10 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-03 10:10 Ian Campbell [this message]
2016-02-03 10:17 ` [PATCH] libxenforeignmemory: handle partial failure correctly Wei Liu
2016-02-03 11:49 ` Ian Campbell
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=1454494201-14910-1-git-send-email-ian.campbell@citrix.com \
--to=ian.campbell@citrix.com \
--cc=ian.jackson@eu.citrix.com \
--cc=wei.liu2@citrix.com \
--cc=xen-devel@lists.xen.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).