[Devel] [PATCH] c/r: avoid crash if incoming object doesn't have .restore
Oren Laadan
orenl at cs.columbia.edu
Mon Mar 15 13:53:39 PDT 2010
Although we are careful in restore_obj() to not invoke obj->restore()
if an incoming object doesn't have .restore, we didn't properly fail.
This patch initialized the @ptr to report an error in this case.
Signed-off-by: Oren Laadan <orenl at cs.columbia.edu>
---
checkpoint/objhash.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/checkpoint/objhash.c b/checkpoint/objhash.c
index 2bfcca7..a14ad14 100644
--- a/checkpoint/objhash.c
+++ b/checkpoint/objhash.c
@@ -1048,7 +1048,7 @@ int restore_obj(struct ckpt_ctx *ctx, struct ckpt_hdr_objref *h)
{
struct ckpt_obj_ops *ops;
struct ckpt_obj *obj;
- void *ptr = NULL;
+ void *ptr = ERR_PTR(-EINVAL);
ckpt_debug("len %d ref %d type %d\n", h->h.len, h->objref, h->objtype);
if (h->objtype >= CKPT_OBJ_MAX)
--
1.6.3.3
_______________________________________________
Containers mailing list
Containers at lists.linux-foundation.org
https://lists.linux-foundation.org/mailman/listinfo/containers
More information about the Devel
mailing list