From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ian Campbell Subject: Re: [PATCH 1/9] libxl: fix libxl__abs_path Date: Mon, 13 Jul 2015 10:57:32 +0100 Message-ID: <1436781452.7019.61.camel@citrix.com> References: <1436551257-28887-1-git-send-email-wei.liu2@citrix.com> <1436551257-28887-2-git-send-email-wei.liu2@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1ZEaUT-0006gG-Th for xen-devel@lists.xenproject.org; Mon, 13 Jul 2015 09:57:38 +0000 In-Reply-To: <1436551257-28887-2-git-send-email-wei.liu2@citrix.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Wei Liu Cc: Xen-devel , Ian Jackson , Andrew Cooper List-Id: xen-devel@lists.xenproject.org On Fri, 2015-07-10 at 19:00 +0100, Wei Liu wrote: I rather dislike subjects of the form "fix $function", since it gives very little clue to someone reading the shortlog what is going on. In this case I think "libxl: make libxl__abs_path correctly handle a NULL argument" would be an accurate description. > If s is NULL, just return NULL to avoid libxl__strdup dereferencing NULL > pointer. > > Signed-off-by: Wei Liu For the change itself: Acked-by: Ian Campbell > --- > tools/libxl/libxl_internal.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/tools/libxl/libxl_internal.c b/tools/libxl/libxl_internal.c > index 42d548e..6402c1b 100644 > --- a/tools/libxl/libxl_internal.c > +++ b/tools/libxl/libxl_internal.c > @@ -233,8 +233,8 @@ void libxl__log(libxl_ctx *ctx, xentoollog_level msglevel, int errnoval, > > char *libxl__abs_path(libxl__gc *gc, const char *s, const char *path) > { > - if (!s || s[0] == '/') > - return libxl__strdup(gc, s); > + if (!s) return NULL; > + if (s[0] == '/') return libxl__strdup(gc, s); > return libxl__sprintf(gc, "%s/%s", path, s); > } >