Skip to contentSkip to conversation

tmem: propagate ENOMEM result in error handling

PATCH In review Matthew Daley 3 participants 3 messages Mar 29, 2014 – Apr 3, 2014

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tmem: propagate ENOMEM result in error handling

...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.

---
 xen/common/tmem.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
xen/common/tmem.c +4 -1
index 02e7e2e..9cebe11 100644
@@ -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:
Signature · 1 line
1.9.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 3 lines · Matthew Daley

...otherwise if pcd_associate fails due to out-of-memory, the caller of do_tmem_put will think the call was successful.

Good catch! Thanks a lot!

Quoted 3 lines

While at it, fix up the style issue.

Quoted 22 lines
---
 xen/common/tmem.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
xen/common/tmem.c +4 -1
index 02e7e2e..9cebe11 100644
@@ -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:
#2 lore raw
Quoted 6 lines · Bob Liu
Quoted 3 lines · Matthew Daley

...otherwise if pcd_associate fails due to out-of-memory, the caller of do_tmem_put will think the call was successful.

Quoted 7 lines

Good catch! Thanks a lot!

Quoted 3 lines

While at it, fix up the style issue.

Thanks!

Quoted 28 lines
Quoted 13 lines
---
 xen/common/tmem.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
xen/common/tmem.c +0 -0
index 02e7e2e..9cebe11 100644
@@ -1646,8 +1646,11 @@ copy_uncompressed:
 
     if ( tmem_dedup_enabled() && !is_persistent(pool) )

xen/common/tmem.c copy_uncompressed: · line 1656

Quoted 10 lines
xen/common/tmem.c +4 -1
     {
-        if ( pcd_associate(pgp,NULL,0) == -ENOMEM )
+        if ( pcd_associate(pgp, NULL, 0) == -ENOMEM )
+        {
+            ret = -ENOMEM;
             goto del_pgp_from_obj;
+        }
     }
 
 insert_page:

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel