aboutsummaryrefslogtreecommitdiffstats
path: root/tools/libxc
diff options
context:
space:
mode:
authorAndrew Cooper <andrew.cooper3@citrix.com>2013-09-10 10:29:39 +0100
committerIan Campbell <ian.campbell@citrix.com>2013-09-10 11:44:02 +0100
commit7bd26ee30d01c36cb94f9a246bf03e8b4f902da9 (patch)
tree7a5951f84cfc2998d8382d695871883a38b47914 /tools/libxc
parent6bc02f74af03e65b5bb62450c1be43ea0f5d2989 (diff)
downloadxen-7bd26ee30d01c36cb94f9a246bf03e8b4f902da9.tar.gz
xen-7bd26ee30d01c36cb94f9a246bf03e8b4f902da9.tar.bz2
xen-7bd26ee30d01c36cb94f9a246bf03e8b4f902da9.zip
libxc/pm: Fix NULL pointer checks.
Discovered by Coverity, CIDs 1054968 1054969 1054970 1054971 1054972 1054973 10549704 This was broken by c/s 5cc436c1d2b3b0 which did a blanket change of 'int xc_handle' -> 'xc_interface *xch'. The types got updated, but error conditions were left as-were. (I suspect some sed was involved originally) Also while playing around in this area, fix up some of the bracketing style to match the Xen coding style. Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com> Acked-by: Ian Campbell <Ian.Campbell@citrix.com> CC: Ian Jackson <Ian.Jackson@eu.citrix.com>
Diffstat (limited to 'tools/libxc')
-rw-r--r--tools/libxc/xc_pm.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/tools/libxc/xc_pm.c b/tools/libxc/xc_pm.c
index fa9b246c9d..ea1e251fb0 100644
--- 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 )
return -EINVAL;
sysctl.cmd = XEN_SYSCTL_pm_op;
@@ -302,7 +302,7 @@ int xc_set_cpufreq_para(xc_interface *xch, int cpuid,
{
DECLARE_SYSCTL;
- if ( xch < 0 )
+ if ( !xch )
return -EINVAL;
sysctl.cmd = XEN_SYSCTL_pm_op;
@@ -319,7 +319,7 @@ int xc_get_cpufreq_avgfreq(xc_interface *xch, int cpuid, int *avg_freq)
int ret = 0;
DECLARE_SYSCTL;
- if ( (xch < 0) || (!avg_freq) )
+ if ( !xch || !avg_freq )
return -EINVAL;
sysctl.cmd = XEN_SYSCTL_pm_op;
@@ -384,7 +384,7 @@ int xc_get_cpuidle_max_cstate(xc_interface *xch, uint32_t *value)
int rc;
DECLARE_SYSCTL;
- if ( xch < 0 || !value )
+ if ( !xch || !value )
return -EINVAL;
sysctl.cmd = XEN_SYSCTL_pm_op;
@@ -401,7 +401,7 @@ int xc_set_cpuidle_max_cstate(xc_interface *xch, uint32_t value)
{
DECLARE_SYSCTL;
- if ( xch < 0 )
+ if ( !xch )
return -EINVAL;
sysctl.cmd = XEN_SYSCTL_pm_op;
@@ -416,7 +416,7 @@ int xc_enable_turbo(xc_interface *xch, int cpuid)
{
DECLARE_SYSCTL;
- if ( xch < 0 )
+ if ( !xch )
return -EINVAL;
sysctl.cmd = XEN_SYSCTL_pm_op;
@@ -429,7 +429,7 @@ int xc_disable_turbo(xc_interface *xch, int cpuid)
{
DECLARE_SYSCTL;
- if ( xch < 0 )
+ if ( !xch )
return -EINVAL;
sysctl.cmd = XEN_SYSCTL_pm_op;