All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: [libvirt] [PATCH 1/2] virdbus: don't force users to pass int for bool values
       [not found]   ` <546FD5D2.60400@redhat.com>
@ 2014-11-24  9:43     ` Ian Campbell
       [not found]     ` <1416822231.26329.19.camel@citrix.com>
  1 sibling, 0 replies; 3+ messages in thread
From: Ian Campbell @ 2014-11-24  9:43 UTC (permalink / raw)
  To: Eric Blake; +Cc: libvir-list, Ian Jackson, cemeyer, xen-devel

On Fri, 2014-11-21 at 17:16 -0700, Eric Blake wrote:
> On 11/20/2014 04:17 PM, Eric Blake wrote:
> > On 11/20/2014 08:12 AM, Conrad Meyer wrote:
> >> Hi Eric,
> >>
> >> I think this change breaks build on FreeBSD:
> >>
> >>   CC       util/libvirt_util_la-virdbus.lo
> >> util/virdbus.c:956:13: error: cast from 'bool *' to 'dbus_bool_t *' (aka 'unsigned int *') increases required alignment from 1 to 4 [-Werror,-Wcast-align]
> >>             GET_NEXT_VAL(dbus_bool_t, bool_val, bool, "%d");
> >>             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> >> util/virdbus.c:858:17: note: expanded from macro 'GET_NEXT_VAL'
> >>             x = (dbustype *)(*xptrptr + (*narrayptr - 1));              \
> >>                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1 error generated.
> > 
> > Valid complaint, so I'll have to figure something out to avoid it.  :(
> > Thanks for the heads up.
> 
> Thanks again for flagging this!
> 
> We had a pre-existing bug.  Even something like "a&n" was broken on
> encoding, because even though type 'n' (int16_t) promotes to a full
> 'int' when parsed via varargs, passing an array of shorts and then
> dereferencing it via (int*) will read beyond array bounds.  We had a
> hole in our testsuite for never testing arrayref with sub-int types,
> even before my commit added 'bool *' to the list of sub-int types that
> we now need to support.

I'm, guessing that this is the same underlying issue as:
        util/virdbus.c: In function 'virDBusMessageIterDecode':
        util/virdbus.c:956:346: error: cast increases required alignment of target type [-Werror=cast-align]
        
which we are seeing in the Xen automated tests [0, 1] (on armhf only,
probably compiler dependent?).

Ian.

[0] http://www.chiark.greenend.org.uk/~xensrcts/logs/31787/build-armhf-libvirt/5.ts-libvirt-build.log
[1] http://www.chiark.greenend.org.uk/~xensrcts/logs/31787/build-armhf-libvirt/info.html

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [libvirt] [PATCH 1/2] virdbus: don't force users to pass int for bool values
       [not found]     ` <1416822231.26329.19.camel@citrix.com>
@ 2014-11-24 16:21       ` Eric Blake
       [not found]       ` <54735AF7.2060103@redhat.com>
  1 sibling, 0 replies; 3+ messages in thread
From: Eric Blake @ 2014-11-24 16:21 UTC (permalink / raw)
  To: Ian Campbell; +Cc: libvir-list, Ian Jackson, cemeyer, xen-devel


[-- Attachment #1.1: Type: text/plain, Size: 1372 bytes --]

On 11/24/2014 02:43 AM, Ian Campbell wrote:

>>>>
>>>> I think this change breaks build on FreeBSD:
>>>>
>>>>   CC       util/libvirt_util_la-virdbus.lo
>>>> util/virdbus.c:956:13: error: cast from 'bool *' to 'dbus_bool_t *' (aka 'unsigned int *') increases required alignment from 1 to 4 [-Werror,-Wcast-align]
>>>>             GET_NEXT_VAL(dbus_bool_t, bool_val, bool, "%d");
>>>>             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>>>> util/virdbus.c:858:17: note: expanded from macro 'GET_NEXT_VAL'
>>>>             x = (dbustype *)(*xptrptr + (*narrayptr - 1));              \
>>>>                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1 error generated.
>>>
>>> Valid complaint, so I'll have to figure something out to avoid it.  :(

> I'm, guessing that this is the same underlying issue as:
>         util/virdbus.c: In function 'virDBusMessageIterDecode':
>         util/virdbus.c:956:346: error: cast increases required alignment of target type [-Werror=cast-align]

Yes.

>         
> which we are seeing in the Xen automated tests [0, 1] (on armhf only,
> probably compiler dependent?).

So, do I have an ACK on my proposed fix yet? :)
https://www.redhat.com/archives/libvir-list/2014-November/msg00838.html

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org


[-- Attachment #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 539 bytes --]

[-- Attachment #2: Type: text/plain, Size: 126 bytes --]

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [libvirt] [PATCH 1/2] virdbus: don't force users to pass int for bool values
       [not found]       ` <54735AF7.2060103@redhat.com>
@ 2014-11-25  9:51         ` Ian Campbell
  0 siblings, 0 replies; 3+ messages in thread
From: Ian Campbell @ 2014-11-25  9:51 UTC (permalink / raw)
  To: Eric Blake; +Cc: libvir-list, Ian Jackson, cemeyer, xen-devel

On Mon, 2014-11-24 at 09:21 -0700, Eric Blake wrote:
> On 11/24/2014 02:43 AM, Ian Campbell wrote:
> 
> >>>>
> >>>> I think this change breaks build on FreeBSD:
> >>>>
> >>>>   CC       util/libvirt_util_la-virdbus.lo
> >>>> util/virdbus.c:956:13: error: cast from 'bool *' to 'dbus_bool_t *' (aka 'unsigned int *') increases required alignment from 1 to 4 [-Werror,-Wcast-align]
> >>>>             GET_NEXT_VAL(dbus_bool_t, bool_val, bool, "%d");
> >>>>             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> >>>> util/virdbus.c:858:17: note: expanded from macro 'GET_NEXT_VAL'
> >>>>             x = (dbustype *)(*xptrptr + (*narrayptr - 1));              \
> >>>>                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1 error generated.
> >>>
> >>> Valid complaint, so I'll have to figure something out to avoid it.  :(
> 
> > I'm, guessing that this is the same underlying issue as:
> >         util/virdbus.c: In function 'virDBusMessageIterDecode':
> >         util/virdbus.c:956:346: error: cast increases required alignment of target type [-Werror=cast-align]
> 
> Yes.
> 
> >         
> > which we are seeing in the Xen automated tests [0, 1] (on armhf only,
> > probably compiler dependent?).
> 
> So, do I have an ACK on my proposed fix yet? :)
> https://www.redhat.com/archives/libvir-list/2014-November/msg00838.html

Well, FWIW it looks good to me:

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

Ian.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-11-25  9:51 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20141120101240.2a75f384@m>
     [not found] ` <546E7674.1060204@redhat.com>
     [not found]   ` <546FD5D2.60400@redhat.com>
2014-11-24  9:43     ` [libvirt] [PATCH 1/2] virdbus: don't force users to pass int for bool values Ian Campbell
     [not found]     ` <1416822231.26329.19.camel@citrix.com>
2014-11-24 16:21       ` Eric Blake
     [not found]       ` <54735AF7.2060103@redhat.com>
2014-11-25  9:51         ` Ian Campbell

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.