[PATCH 1/2] cr: be more informative with obj_new errors

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

 



From: Serge E. Hallyn <serue@xxxxxxxxxx>

If some checkpoint object type was mis-registered or mis-used,
at least give some info to help deduce the caller.

Signed-off-by: Serge E. Hallyn <serue@xxxxxxxxxx>
---
 kernel/checkpoint/objhash.c |   13 +++++++++++--
 1 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/kernel/checkpoint/objhash.c b/kernel/checkpoint/objhash.c
index af1e5e7..6a3937e 100644
--- a/kernel/checkpoint/objhash.c
+++ b/kernel/checkpoint/objhash.c
@@ -188,9 +188,18 @@ static struct ckpt_obj *obj_new(struct ckpt_ctx *ctx, void *ptr,
 	int i, ret;
 
 	/* explicitly disallow null pointers */
-	BUG_ON(!ptr);
+	if (!ptr) {
+		ckpt_err(ctx, -EINVAL, "checkpointing NULL type %d\n", type);
+		return -EINVAL;
+	}
+
 	/* make sure we don't change this accidentally */
-	BUG_ON(ops->obj_type != type);
+	if (ops->obj_type != type)
+	{
+		ckpt_err(ctx, -EINVAL, "type mismatch: %d->ops->obj_type %d\n",
+			type, ops->obj_type);
+		return ERR_PTR(-EINVAL);
+	}
 
 	obj = kzalloc(sizeof(*obj), GFP_KERNEL);
 	if (!obj)
-- 
1.7.0.4

_______________________________________________
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