[PATCH] c/r: avoid crash if incoming object doesn't have .restore

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxxx>
---
 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@xxxxxxxxxxxxxxxxxxxxxxxxxx
https://lists.linux-foundation.org/mailman/listinfo/containers

[Index of Archives]     [Cgroups]     [Netdev]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux