From nobody Thu Nov 6 03:30:11 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1539582888892504.94964108407623; Sun, 14 Oct 2018 22:54:48 -0700 (PDT) Received: from localhost ([::1]:50495 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gBvpu-0003pE-DC for importer@patchew.org; Mon, 15 Oct 2018 01:54:38 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36532) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gBvp1-0003Wb-A2 for qemu-devel@nongnu.org; Mon, 15 Oct 2018 01:53:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gBvox-00037w-5D for qemu-devel@nongnu.org; Mon, 15 Oct 2018 01:53:43 -0400 Received: from mx1.redhat.com ([209.132.183.28]:59114) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gBvow-00037J-VR for qemu-devel@nongnu.org; Mon, 15 Oct 2018 01:53:39 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 8C743308FBAE for ; Mon, 15 Oct 2018 05:53:37 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-116-238.ams2.redhat.com [10.36.116.238]) by smtp.corp.redhat.com (Postfix) with ESMTP id 91AB01057069; Mon, 15 Oct 2018 05:53:34 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id BB7ABA0DD7; Mon, 15 Oct 2018 07:53:33 +0200 (CEST) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Mon, 15 Oct 2018 07:53:33 +0200 Message-Id: <20181015055333.32030-1-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.43]); Mon, 15 Oct 2018 05:53:37 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH] edid: fix alignment issues X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Gerd Hoffmann Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RDMRC_1 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Use stl_le_p() & friends instead of casts. Signed-off-by: Gerd Hoffmann Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Richard Henderson --- hw/display/edid-generate.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/hw/display/edid-generate.c b/hw/display/edid-generate.c index 37e60fe42a..bdf5e1d4d4 100644 --- a/hw/display/edid-generate.c +++ b/hw/display/edid-generate.c @@ -223,7 +223,7 @@ static void edid_desc_timing(uint8_t *desc, =20 uint32_t clock =3D 75 * (xres + xblank) * (yres + yblank); =20 - *(uint32_t *)(desc) =3D cpu_to_le32(clock / 10000); + stl_le_p(desc, clock / 10000); =20 desc[2] =3D xres & 0xff; desc[3] =3D xblank & 0xff; @@ -342,9 +342,9 @@ void qemu_edid_generate(uint8_t *edid, size_t size, (((info->vendor[2] - '@') & 0x1f) << 0)); uint16_t model_nr =3D 0x1234; uint32_t serial_nr =3D info->serial ? atoi(info->serial) : 0; - *(uint16_t *)(edid + 8) =3D cpu_to_be16(vendor_id); - *(uint16_t *)(edid + 10) =3D cpu_to_le16(model_nr); - *(uint32_t *)(edid + 12) =3D cpu_to_le32(serial_nr); + stw_be_p(edid + 8, vendor_id); + stw_le_p(edid + 10, model_nr); + stl_le_p(edid + 12, serial_nr); =20 /* manufacture week and year */ edid[16] =3D 42; --=20 2.9.3