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

Matt Helsley matthltc at us.ibm.com
Fri Apr 9 18:29:30 PDT 2010


On Fri, Apr 09, 2010 at 04:12:57PM -0500, Serge Hallyn wrote:
> From: Serge E. Hallyn <serue at us.ibm.com>
> 
> 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 at us.ibm.com>

Pulled, thanks!

Cheers,
	-Matt Helsley

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




More information about the Devel mailing list