From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58969) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gCnEp-00034N-AN for qemu-devel@nongnu.org; Wed, 17 Oct 2018 10:55:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gCnEo-00038A-L4 for qemu-devel@nongnu.org; Wed, 17 Oct 2018 10:55:55 -0400 Date: Wed, 17 Oct 2018 16:55:46 +0200 From: Kevin Wolf Message-ID: <20181017145546.GG31479@localhost.localdomain> References: <20181016172503.27814-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20181016172503.27814-1-peter.maydell@linaro.org> Subject: Re: [Qemu-devel] [PATCH] block/vdi: Don't take address of fields in packed structs List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Maydell Cc: qemu-devel@nongnu.org, patches@linaro.org, Stefan Weil , Max Reitz , qemu-block@nongnu.org Am 16.10.2018 um 19:25 hat Peter Maydell geschrieben: > 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. > > There are a few places where the in-place swap function is > used on something other than a packed struct field; we convert > those anyway, for consistency. > > Patch produced with scripts/coccinelle/inplace-byteswaps.cocci. > > There are other places where we take the address of a packed member > in this file for other purposes than passing it to a byteswap > function (all the calls to qemu_uuid_*()); we leave those for now. > > Signed-off-by: Peter Maydell Thanks, applied to the block branch. Kevin