From mboxrd@z Thu Jan 1 00:00:00 1970 From: Konrad Rzeszutek Wilk Subject: [PATCH 2/4] xc/tmem: Unchecked return value (v2). Date: Wed, 30 Apr 2014 16:29:14 -0400 Message-ID: <1398889756-16352-3-git-send-email-konrad.wilk@oracle.com> References: <1398889756-16352-1-git-send-email-konrad.wilk@oracle.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1Wfb89-0001dq-Kz for xen-devel@lists.xenproject.org; Wed, 30 Apr 2014 20:29:27 +0000 In-Reply-To: <1398889756-16352-1-git-send-email-konrad.wilk@oracle.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel@lists.xenproject.org, andrew.cooper3@citrix.com, jbeulich@suse.com, keir@xen.org Cc: Konrad Rzeszutek Wilk List-Id: xen-devel@lists.xenproject.org CID 1055045 complains that the return value needs checking. The tmem op is a flush call and there is no expectation right now of any return besides zero. But just in case this changes lets blow up. CC: Bob Liu Signed-off-by: Konrad Rzeszutek Wilk [v2: Add a comment why bailing out on xc_tmem_save_done is not needed] --- tools/libxc/xc_domain_save.c | 8 ++++++-- tools/libxc/xc_tmem.c | 4 ++-- tools/libxc/xenctrl.h | 2 +- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/tools/libxc/xc_domain_save.c b/tools/libxc/xc_domain_save.c index 71f9b59..b04e387 100644 --- a/tools/libxc/xc_domain_save.c +++ b/tools/libxc/xc_domain_save.c @@ -2107,8 +2107,12 @@ int xc_domain_save(xc_interface *xch, int io_fd, uint32_t dom, uint32_t max_iter goto copypages; } - if ( tmem_saved != 0 && live ) - xc_tmem_save_done(xch, dom); + if ( tmem_saved != 0 && live && xc_tmem_save_done(xch, dom)) + { + /* N.B. No need to bail out - we leak memory, but that is all assigned + * to the zombie guest. */ + DPRINTF("Warning - failed to flush tmem on originating server."); + } if ( live ) { diff --git a/tools/libxc/xc_tmem.c b/tools/libxc/xc_tmem.c index 12fa105..6e01a6a 100644 --- a/tools/libxc/xc_tmem.c +++ b/tools/libxc/xc_tmem.c @@ -356,9 +356,9 @@ int xc_tmem_save_extra(xc_interface *xch, int dom, int io_fd, int field_marker) } /* only called for live migration */ -void xc_tmem_save_done(xc_interface *xch, int dom) +int xc_tmem_save_done(xc_interface *xch, int dom) { - xc_tmem_control(xch,0,TMEMC_SAVE_END,dom,0,0,0,NULL); + return xc_tmem_control(xch,0,TMEMC_SAVE_END,dom,0,0,0,NULL); } /* restore routines */ diff --git a/tools/libxc/xenctrl.h b/tools/libxc/xenctrl.h index 02129f7..23630a7 100644 --- a/tools/libxc/xenctrl.h +++ b/tools/libxc/xenctrl.h @@ -2011,7 +2011,7 @@ int xc_tmem_control(xc_interface *xch, int xc_tmem_auth(xc_interface *xch, int cli_id, char *uuid_str, int arg1); int xc_tmem_save(xc_interface *xch, int dom, int live, int fd, int field_marker); int xc_tmem_save_extra(xc_interface *xch, int dom, int fd, int field_marker); -void xc_tmem_save_done(xc_interface *xch, int dom); +int xc_tmem_save_done(xc_interface *xch, int dom); int xc_tmem_restore(xc_interface *xch, int dom, int fd); int xc_tmem_restore_extra(xc_interface *xch, int dom, int fd); -- 1.8.5.3