From mboxrd@z Thu Jan 1 00:00:00 1970 From: Matthew Daley Subject: [PATCH] tmem: propagate ENOMEM result in error handling Date: Sat, 29 Mar 2014 18:07:29 +1300 Message-ID: <1396069649-5773-1-git-send-email-mattd@bugfuzz.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: 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 Cc: Matthew Daley , xen-devel@lists.xen.org List-Id: xen-devel@lists.xenproject.org ...otherwise if pcd_associate fails due to out-of-memory, the caller of do_tmem_put will think the call was successful. While at it, fix up the style issue. Signed-off-by: Matthew Daley --- xen/common/tmem.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/xen/common/tmem.c b/xen/common/tmem.c index 02e7e2e..9cebe11 100644 --- a/xen/common/tmem.c +++ b/xen/common/tmem.c @@ -1646,8 +1646,11 @@ copy_uncompressed: if ( tmem_dedup_enabled() && !is_persistent(pool) ) { - if ( pcd_associate(pgp,NULL,0) == -ENOMEM ) + if ( pcd_associate(pgp, NULL, 0) == -ENOMEM ) + { + ret = -ENOMEM; goto del_pgp_from_obj; + } } insert_page: -- 1.9.0