[libvirt] [PATCH 4/7] Copy struct inotify_event entries to avoid alignment problems

Eric Blake eblake at redhat.com
Fri Apr 5 20:53:24 UTC 2013


On 04/03/2013 09:06 AM, Daniel P. Berrange wrote:
> From: "Daniel P. Berrange" <berrange at redhat.com>
> 
> When reading the inotify FD, we get back a sequence of
> struct inotify_event, each with variable length data following.
> It is not safe to simply cast from the char *buf to the
> struct inotify_event struct since this may violate data
> alignment rules. Thus we must copy from the char *buf
> into the struct inotify_event instance before accessing
> the data.
> 
> uml/uml_driver.c: In function 'umlInotifyEvent':
> uml/uml_driver.c:327:13: warning: cast increases required alignment of target type [-Wcast-align]
>          e = (struct inotify_event *)tmp;
> 
> Signed-off-by: Daniel P. Berrange <berrange at redhat.com>
> ---
>  src/uml/uml_driver.c | 22 +++++++++++-----------
>  1 file changed, 11 insertions(+), 11 deletions(-)

ACK.

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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 621 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20130405/c2a2adb9/attachment-0001.sig>


More information about the libvir-list mailing list