qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH] nbd: Don't take address of fields in packed str


From: Eric Blake
Subject: Re: [Qemu-devel] [PATCH] nbd: Don't take address of fields in packed structs
Date: Thu, 27 Sep 2018 12:16:13 -0500
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.0

On 9/27/18 11:42 AM, Peter Maydell wrote:
Taking the address of a field in a packed struct is a bad idea, because
it might not be actually aligned enough for that pointer type (and
thus cause a crash on dereference on some host architectures). Newer
versions of clang warn about this. Avoid the bug by not using the
"modify in place" byte swapping functions.

This patch was produced with the following spatch script:


Will queue through my NBD tree.


Signed-off-by: Peter Maydell <address@hidden>
---
Disclaimer: tested only with "make check", but it is a mechanically
generated patch...


Reviewed-by: Eric Blake <address@hidden>

Conflicts with my pending NBD pull request, but I can touch that up (and ensure that it gets more than just compile-time testing, even though I agree that the change is safe from a pure review standpoint).

--
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org



reply via email to

[Prev in Thread] Current Thread [Next in Thread]