|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH] libxc/pm: Fix NULL pointer checks.
Andrew Cooper writes ("[PATCH] 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)
I see this has been committed, but I feel moved to comment:
...
> diff --git a/tools/libxc/xc_pm.c b/tools/libxc/xc_pm.c
> index fa9b246..ea1e251 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;
TBH I think callers who pass null xch's into xc should get a null
pointer dereference, not EINVAL.
But I don't propose to try to go through libxc and drain its crazy
error handling swamp.
Ian.
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |