[Devel] Re: [PATCH 1/1] cr: fix ckpt_obj_fetch return values
Serge E. Hallyn
serue at us.ibm.com
Wed May 13 11:43:58 PDT 2009
Quoting Serge E. Hallyn (serue at us.ibm.com):
> ckpt_obj_fetch returned ERR_PTR(error) on some failures, NULL on
> others. Not all of its callers were checking for NULL, which
> would lead to NULL dereferences.
>
> Return -EINVAL if the object is not in the hash table. Fix up
> pipe_file_restore to do the right thing.
>
> Signed-off-by: Serge E. Hallyn <serue at us.ibm.com>
> ---
> checkpoint/files.c | 4 +---
> checkpoint/memory.c | 6 +-----
> checkpoint/objhash.c | 2 +-
> checkpoint/process.c | 4 +---
> fs/pipe.c | 9 ++++-----
> 5 files changed, 8 insertions(+), 17 deletions(-)
>
> diff --git a/checkpoint/objhash.c b/checkpoint/objhash.c
> index 0ed7cac..7b26005 100644
> --- a/checkpoint/objhash.c
> +++ b/checkpoint/objhash.c
> @@ -692,7 +692,7 @@ void *ckpt_obj_fetch(struct ckpt_ctx *ctx, int objref, enum obj_type type)
>
> obj = obj_find_by_objref(ctx, objref);
> if (!obj)
> - return NULL;
> + ERR_PTR(-EINVAL);
obvious bug here :)
-serge
_______________________________________________
Containers mailing list
Containers at lists.linux-foundation.org
https://lists.linux-foundation.org/mailman/listinfo/containers
More information about the Devel
mailing list