From: "Jan Beulich" Subject: Re: [PATCH] libxc/pm: Fix NULL pointer checks. Date: Tue, 10 Sep 2013 13:23:20 +0100 Message-ID: <522F2B5802000078000F1DEF@nat28.tlf.novell.com> References: <1378805379-18700-1-git-send-email-andrew.cooper3@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta14.messagelabs.com ([193.109.254.103]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1VJN09-0001Cr-No for xen-devel@lists.xenproject.org; Tue, 10 Sep 2013 12:25:01 +0000 In-Reply-To: <1378805379-18700-1-git-send-email-andrew.cooper3@citrix.com> Content-Disposition: inline List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Andrew Cooper Cc: xen-devel , Ian Jackson , Ian Campbell List-Id: xen-devel@lists.xenproject.org >>> On 10.09.13 at 11:29, Andrew Cooper wrote: > --- a/tools/libxc/xc_pm.c > +++ b/tools/libxc/xc_pm.c > @@ -285,7 +285,7 @@ int xc_set_cpufreq_gov(xc_interface *xch, int cpuid, char *govname) > DECLARE_SYSCTL; > char *scaling_governor = sysctl.u.pm_op.u.set_gov.scaling_governor; > > - if ( (xch < 0) || (!govname) ) > + if ( !xch || !govname ) I'm very surprised the compiler didn't reject this - I'm unaware of an extension that would allow pointers to be compared by other than == and != (plus it's all but clear what e.g. a "negative" pointer really is). Jan