From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57378) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fAc5N-0000vb-IF for qemu-devel@nongnu.org; Mon, 23 Apr 2018 10:04:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fAc5M-0003TR-J2 for qemu-devel@nongnu.org; Mon, 23 Apr 2018 10:04:53 -0400 Received: from mail-oi0-x22c.google.com ([2607:f8b0:4003:c06::22c]:41742) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fAc5M-0003T5-EG for qemu-devel@nongnu.org; Mon, 23 Apr 2018 10:04:52 -0400 Received: by mail-oi0-x22c.google.com with SMTP id 188-v6so14367087oih.8 for ; Mon, 23 Apr 2018 07:04:52 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: References: <20180421211652.14794-1-f4bug@amsat.org> <20180423031639.GB19804@umbus.fritz.box> From: Peter Maydell Date: Mon, 23 Apr 2018 15:04:31 +0100 Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH] loader: Fix misaligned member access List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: =?UTF-8?Q?Philippe_Mathieu=2DDaud=C3=A9?= Cc: David Gibson , =?UTF-8?B?TWFyYy1BbmRyw6kgTHVyZWF1?= , Paul Burton , QEMU Developers On 23 April 2018 at 14:57, Philippe Mathieu-Daud=C3=A9 wr= ote: > On 04/23/2018 12:16 AM, David Gibson wrote: >> On Sun, Apr 22, 2018 at 11:41:20AM +0100, Peter Maydell wrote: >>> If we need to do an unaligned load, then ldl_p() is the >>> right way to do it. (We could also just do >>> *addr =3D ldl_be_p(prop) but we maybe don't want to >>> bake in knowledge that FDT is big-endian). > > Since it is, ldl_be_p() seems the clever/cleaner way indeed, but then we > assume we know the underlying type of fdt32_t; while using memcpy we > respect the FDT API. *addr =3D fdt32_to_cpu(ldl_p(prop)); is better than a raw memcpy still. thanks -- PMM