From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Serge E. Hallyn" Subject: Re: [PATCH 1/1] cr: fix ckpt_obj_fetch return values Date: Wed, 13 May 2009 13:43:58 -0500 Message-ID: <20090513184358.GA20393@us.ibm.com> References: <20090513165251.GA18539@us.ibm.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Content-Disposition: inline In-Reply-To: <20090513165251.GA18539-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: containers-bounces-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org Errors-To: containers-bounces-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org To: Oren Laadan Cc: Linux Containers List-Id: containers.vger.kernel.org Quoting Serge E. Hallyn (serue-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org): > 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 > --- > 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