From patchwork Thu Jun 27 13:37:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Akihiko Odaki X-Patchwork-Id: 1953282 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=daynix-com.20230601.gappssmtp.com header.i=@daynix-com.20230601.gappssmtp.com header.a=rsa-sha256 header.s=20230601 header.b=F1dG3X3T; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-ppc-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4W90712tGRz20Xg for ; Thu, 27 Jun 2024 23:39:57 +1000 (AEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sMpKy-0001FT-6A; Thu, 27 Jun 2024 09:38:56 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sMpKt-0001Ap-QD for qemu-ppc@nongnu.org; Thu, 27 Jun 2024 09:38:52 -0400 Received: from mail-ot1-x32b.google.com ([2607:f8b0:4864:20::32b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sMpKr-0006Qi-6h for qemu-ppc@nongnu.org; Thu, 27 Jun 2024 09:38:51 -0400 Received: by mail-ot1-x32b.google.com with SMTP id 46e09a7af769-6fa0d077694so3705434a34.0 for ; Thu, 27 Jun 2024 06:38:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20230601.gappssmtp.com; s=20230601; t=1719495526; x=1720100326; darn=nongnu.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=UtuCMhxUWw1DUkDzmxPc06M4yVAzJqdA967oAcSFqUQ=; b=F1dG3X3TWPB9MXJKsI7+ya5OpeWHWBLL17c5SmjmZ76jc3XRALRPlsyyqqoCV0RM0j FnY2hLEAiMpBP2hfUnEZLtibcTvC/iX8v0wef5P6iDuChmKG5HrlCMjCfQ8b1+nNkK9o CyqPFUIlT3EIwXOEyQOxyloxcLwfvAVVEFWLxZmOrxgFxaKDm/unbVI1MhsO4qBuqE2u aXBOw2M14si5rxZVDKuUsCdhYBqtvTIscjlvAVK9/stpjSxe7upnftCFRSu2KUhsDlrj fLxAvkoFJaZoo2o4XGEw7l/pPObHJ0oRbCoScoi4rAJd2zDpJWb2vg7WhLNpK6P3HfVr QZOQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719495526; x=1720100326; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=UtuCMhxUWw1DUkDzmxPc06M4yVAzJqdA967oAcSFqUQ=; b=mPEkvRcrXUsMW55f6i3+uDn5pUUnxS1fF4kaS2Occaczdn4hP0/PsVGWsaysbly6W0 J5AjEYBcMc8TSm4lJTs3anPRh+3hP+GysVbhTsyOiH1ro3zXXc0hKMawMhZu1hIajzPe IzE4rMa6eJ0NLjmFAWXB5i0HGimEuj+f159fGFEk90ZBbJLQkNR2JsH+ciz1Kti0YPHf pk4jgzeDSVFaCnprtdvxb8drhMSiy4eaHPmBKgzmJ1bJk1o1Lhyy3khZQ/TY5gQR+py/ ljuMGgD/Zsm5hqAHfO4jsbY7xxphW4Byzm6cjQwYDSkl0QU/2F6HqviBeuo1SnDqwnhm Nqsw== X-Forwarded-Encrypted: i=1; AJvYcCVwDcbCMyCxlJFX48wGXIlS0Y4IzEJJDUVG3wBTPDMR6gqnAbNY6ZGrp4EIn18ezloIfqvKJg+MyUl6v3YE5NtlIl77 X-Gm-Message-State: AOJu0YzRDKFWEFq2rknhIYWrXZN6QZsU7TD59+BOKtNvEQxkEoZ3ksfq wiqetBsWTolyT+uFzsdVz2urC3HviLJxIMBDvr6dZdcOeKivjsdg/jiXc37sLS8= X-Google-Smtp-Source: AGHT+IE68QrvJItc29/tXsB2hhrn925IlwaD+nMu6WIGfpGM9AqZp/e9DNODXCKlCLfsXKLgBm7gVg== X-Received: by 2002:a05:6870:9692:b0:254:c27c:1b19 with SMTP id 586e51a60fabf-25d06ec3501mr16894009fac.54.1719495526263; Thu, 27 Jun 2024 06:38:46 -0700 (PDT) Received: from localhost ([2400:4050:a840:1e00:9ac7:6d57:2b16:6932]) by smtp.gmail.com with UTF8SMTPSA id d2e1a72fcca58-706b491c898sm1333327b3a.77.2024.06.27.06.38.41 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 27 Jun 2024 06:38:45 -0700 (PDT) From: Akihiko Odaki Date: Thu, 27 Jun 2024 22:37:49 +0900 Subject: [PATCH v2 06/15] ppc/vof: Fix unaligned FDT property access MIME-Version: 1.0 Message-Id: <20240627-san-v2-6-750bb0946dbd@daynix.com> References: <20240627-san-v2-0-750bb0946dbd@daynix.com> In-Reply-To: <20240627-san-v2-0-750bb0946dbd@daynix.com> To: Eduardo Habkost , Marcel Apfelbaum , =?utf-8?q?Philippe_Mathieu-?= =?utf-8?q?Daud=C3=A9?= , Yanan Wang , John Snow , BALATON Zoltan , Jiaxun Yang , Nicholas Piggin , Daniel Henrique Barboza , David Gibson , Harsh Prateek Bora , Alexey Kardashevskiy , "Michael S. Tsirkin" , =?utf-8?q?Alex_Benn=C3=A9e?= , Peter Xu , Fabiano Rosas , Paolo Bonzini , David Hildenbrand , Thomas Huth , Laurent Vivier Cc: qemu-devel@nongnu.org, qemu-block@nongnu.org, qemu-ppc@nongnu.org, Akihiko Odaki X-Mailer: b4 0.14-dev-fd6e3 Received-SPF: none client-ip=2607:f8b0:4864:20::32b; envelope-from=akihiko.odaki@daynix.com; helo=mail-ot1-x32b.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-ppc@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-ppc-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-ppc-bounces+incoming=patchwork.ozlabs.org@nongnu.org FDT properties are aligned by 4 bytes, not 8 bytes. Signed-off-by: Akihiko Odaki Reviewed-by: Peter Maydell --- hw/ppc/vof.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/ppc/vof.c b/hw/ppc/vof.c index e3b430a81f4f..b5b6514d79fc 100644 --- a/hw/ppc/vof.c +++ b/hw/ppc/vof.c @@ -646,7 +646,7 @@ static void vof_dt_memory_available(void *fdt, GArray *claimed, uint64_t base) mem0_reg = fdt_getprop(fdt, offset, "reg", &proplen); g_assert(mem0_reg && proplen == sizeof(uint32_t) * (ac + sc)); if (sc == 2) { - mem0_end = be64_to_cpu(*(uint64_t *)(mem0_reg + sizeof(uint32_t) * ac)); + mem0_end = ldq_be_p(mem0_reg + sizeof(uint32_t) * ac); } else { mem0_end = be32_to_cpu(*(uint32_t *)(mem0_reg + sizeof(uint32_t) * ac)); }