Quoting Serge Hallyn ([email protected]):
> From: Serge E. Hallyn <[email protected]>
> 
> 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 <[email protected]>
> ---
>  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;

Gah, sorry, that should be an ERR_PTR(-EINVAL) of course

> +     }
> +
>       /* 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
> [email protected]
> https://lists.linux-foundation.org/mailman/listinfo/containers
_______________________________________________
Containers mailing list
[email protected]
https://lists.linux-foundation.org/mailman/listinfo/containers

_______________________________________________
Devel mailing list
[email protected]
https://openvz.org/mailman/listinfo/devel

Reply via email to