tmem: propagate ENOMEM result in error handling
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.
Signed-off-by Matthew Daley <[email protected]>
--- xen/common/tmem.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
xen/common/tmem.c +4 -1
@@ -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
Quoted 3 lines · Matthew Daley
...otherwise if
pcd_associatefails due to out-of-memory, the caller ofdo_tmem_putwill think the call was successful.
Good catch! Thanks a lot!
Quoted 3 lines
While at it, fix up the style issue.
Signed-off-by Matthew Daley <[email protected]>
Reviewed-by Bob Liu <[email protected]>
Quoted 22 lines
--- xen/common/tmem.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)xen/common/tmem.c +4
-1@@ -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:
Konrad Rzeszutek Wilk
Acked-byQuoted 6 lines · Bob Liu
Quoted 3 lines · Matthew Daley
...otherwise if
pcd_associatefails due to out-of-memory, the caller ofdo_tmem_putwill think the call was successful.
Quoted 7 lines
Good catch! Thanks a lot!
Quoted 3 lines
While at it, fix up the style issue.
Signed-off-by Matthew Daley <[email protected]>Reviewed-by Bob Liu <[email protected]>
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@@ -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