[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH 12/34] xen/arm: psci: Don't need to check if vcpuid is negative



On Tue, 2014-03-25 at 16:55 +0000, Julien Grall wrote:
> vcpuid is unsigned int, therefore the value will never be negative.
> 
> It fixes compilation with clang 3.5:
> vpsci.c:29:18: error: comparison of unsigned expression < 0 is always false 
> [-Werror,-Wtautological-compare]
>     if ( (vcpuid < 0) || (vcpuid >= MAX_VIRT_CPUS) )
>           ~~~~~~ ^ ~

These sorts of compiler warnings annoy me because one thing the existing
check protects against is someone who changes the type of the variable
to a signed type (and vcpuid is often held in a signed type inside Xen I
think), at which point the condition can become true.

But any way, I expect I'm in the minority here, and in this specific
case the type of vcpuid is mandated by the PSCI standard (I think) so:

> Signed-off-by: Julien Grall <julien.grall@xxxxxxxxxx>

Acked-by: Ian Campbell <ian.campbell@xxxxxxxxxx>

Ian.


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.