From mboxrd@z Thu Jan 1 00:00:00 1970 From: Oren Laadan Subject: Re: [PATCH 2/5] Add an errno validation function Date: Wed, 22 Jul 2009 23:17:40 -0400 Message-ID: <4A67D654.2000206@librato.com> References: <1248295301-30930-1-git-send-email-danms@us.ibm.com> <1248295301-30930-3-git-send-email-danms@us.ibm.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1248295301-30930-3-git-send-email-danms-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: Dan Smith Cc: containers-qjLDD68F18O7TbgM5vRIOg@public.gmane.org List-Id: containers.vger.kernel.org Dan Smith wrote: > Signed-off-by: Dan Smith > --- > include/linux/checkpoint.h | 5 +++++ > 1 files changed, 5 insertions(+), 0 deletions(-) > > diff --git a/include/linux/checkpoint.h b/include/linux/checkpoint.h > index 2e9772e..93efa10 100644 > --- a/include/linux/checkpoint.h > +++ b/include/linux/checkpoint.h > @@ -261,6 +261,11 @@ extern void *restore_sighand(struct ckpt_ctx *ctx); > memcpy(LIVE, SAVE, count * sizeof(*SAVE)); \ > } while (0) > > +static inline int ckpt_validate_errno(int errno) > +{ > + /* Current highest errno is ~530; this should provide some sanity */ > + return (errno >= 0) && (errno < 1024); > +} > How about: return (errno >= 0 || IS_ERR_VALUE(errno)); IS_ERR_VALUE is defined in include/linux/err.h Oren.