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

Re: [Xen-devel] [PATCH] tests/cpu-policy: fix format-overflow warning by null terminating strings



On Thu, 2019-07-25 at 10:25 +0200, Roger Pau Monné wrote:
> On Wed, Jul 24, 2019 at 05:53:26PM -0700, 
> christopher.w.clark@xxxxxxxxx wrote:
> > From: Christopher Clark <christopher.w.clark@xxxxxxxxx>
> > 
> > diff --git a/tools/tests/cpu-policy/test-cpu-policy.c
> > b/tools/tests/cpu-policy/test-cpu-policy.c
> > index ca3b8dd45f..c91408a93a 100644
> > --- a/tools/tests/cpu-policy/test-cpu-policy.c
> > +++ b/tools/tests/cpu-policy/test-cpu-policy.c
> > @@ -35,9 +35,10 @@ static void test_vendor_identification(void)
> >  {
> >      static const struct test {
> >          union {
> > -            char ident[12];
> > +            char ident[13];
> >              struct {
> >                  uint32_t b, d, c;
> > +                char null_terminator;
> 
> Do you really need this field here, AFAICT it's unused. The compiler
> will add the padding here automatically to match the size of the
> other
> field of the union.
> 
Yep, I run into this myself (and sent a mail about it yesterday), and,
FWIW, I confirm that just growing the array to 13 both builds, with
GCC9, and works. :-)

Regards
-- 
Dario Faggioli, Ph.D
http://about.me/dario.faggioli
Virtualization Software Engineer
SUSE Labs, SUSE https://www.suse.com/
-------------------------------------------------------------------
<<This happens because _I_ choose it to happen!>> (Raistlin Majere)

Attachment: signature.asc
Description: This is a digitally signed message part

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

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