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

2018-09-27 Thread Philippe Mathieu-Daudé
On 9/27/18 7:16 PM, Eric Blake wrote: > 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

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

2018-09-27 Thread Peter Maydell
On 27 September 2018 at 19:16, Eric Blake wrote: > Okay, I am also in favor of the complete conversion. Want me to squash in > the remaining 3 spots as part of queuing my patch, so you don't have to send > a v2? Yes, please. thanks -- PMM

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

2018-09-27 Thread Eric Blake
On 9/27/18 1:03 PM, Peter Maydell wrote: I'm a bit confused. After applying your patch (and rebasing it to my pending pull request), I still found instances of be16_to_cpus() and others. Were you only flipping instances that were members of a packed struct, while leaving other instances unchang

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

2018-09-27 Thread Peter Maydell
On 27 September 2018 at 18:30, Eric Blake wrote: > 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 archite

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

2018-09-27 Thread Eric Blake
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 bu

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

2018-09-27 Thread Eric Blake
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 bu

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

2018-09-27 Thread Peter Maydell
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 sw