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

Re: [Xen-devel] [PATCH] xen/xsm: Shut up GCC 5.1.1 warnings.



On 16/09/2015 18:12, Konrad Rzeszutek Wilk wrote:
> policydb.c: In function âuser_readâ:
> policydb.c:1443:26: error: âbuf[2]â may be used uninitialized in this 
> function [-Werror=maybe-uninitialized]
>          usrdatum->bounds = le32_to_cpu(buf[2]);
>                           ^
> cc1: all warnings being treated as errors
>
> Which makes no sense, as :
>  1). A couple of lines above it is being filled (buf[2]).
>  2). There are other instances of this which are not triggering this
>      failure.
>
> But GCC insists, and this patch stops the failures.
>
> Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx>

A better bet would just be to initialise buf at declaration time, so
"__le32 buf[3] = { 0 };"

The reason this warning is firing is that C may not assume that
p->policyvers doesn't change between the next_entry() call and the
role->bounds assignment.  Pulling p->policyvers into a local variable
might also be sufficient.

~Andrew

_______________________________________________
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®.