From patchwork Fri Jan 4 14:43:33 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 154778 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp690719ljp; Fri, 4 Jan 2019 06:43:58 -0800 (PST) X-Google-Smtp-Source: ALg8bN5ICa4mtCJpwUMY79iM/1xlaxn74o1aONZ9LwYwuQd5uUH5sekdapeJc3p/oKtOFZI7OKx2 X-Received: by 2002:a63:ca02:: with SMTP id n2mr1914382pgi.187.1546613038858; Fri, 04 Jan 2019 06:43:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1546613038; cv=none; d=google.com; s=arc-20160816; b=GtEI7ArIzuo+lxMXfJLQ+whVOFycT2CJnz969lyorSpunBUFIWJ2zxbWZplNxy0iJu ash5AwaD58iWOuzhHaVWUX+VxnMtQcouPECwmXwkFR/NaVCSp3pvxZ2Bf7KuD5ILfYQ+ C+uBgDEamwlCUAjTOTreVy3WuaeL7XkRF4ncUU6jxa1W5b8+BhcuhALnzgsG6IDrTQ8V FuNh7sN8ohw61kyDAUzKp/tvlEB8+CII0zq7Yc/NsdQwY9odfHaHbIkugCkHwB5IQJvC vQ8DovYkgJpgzCGSOgxuXwLM+ritO0R7muifOlSCz74Wn1cDmHDLyOmO6F8eXjZ1oQZb bHBA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:references:in-reply-to:message-id:date :to:from:dkim-signature:delivered-to; bh=5ik+1a7O9RKLZg48cr7x/YTplNKnmqa9ZWTzwBf55Pc=; b=i8/YwPmsm8VbL5yEd936dyWerAmek+JFXbvMK27ERRnjuHoOFoCb6vTMZShijTTR39 ccQqaeKMo8FJeo1L5CGjN58iV3iozDuV8Xm6GwMzfNAGPdpA4U1i4zrY37KfajvFjuZN gpZcmNvVkxmo0A6vRkS2rbDuSy1MA5uInXbcbWr9xlQi+w0pHX+A6PTvdEA7nX+Lkoiy Jud74BucQIqsIgibYdplIA412ukHYFaTBg4/PfwjEVV2Ftg2BkFBdooiUyZRE5FhL3nr +ifgvf31fMxGrBNVcOewZ7JZIIgawlPKEha4UV3PhlR90ctZLq19OA0omOAuhPkxum8L f2OA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=aCoTvEBN; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 198.145.21.10 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from ml01.01.org (ml01.01.org. [198.145.21.10]) by mx.google.com with ESMTPS id y17si33333654pll.10.2019.01.04.06.43.58 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 04 Jan 2019 06:43:58 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 198.145.21.10 as permitted sender) client-ip=198.145.21.10; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=aCoTvEBN; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 198.145.21.10 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 505DB211AEA44; Fri, 4 Jan 2019 06:43:52 -0800 (PST) X-Original-To: edk2-devel@lists.01.org Delivered-To: edk2-devel@lists.01.org Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2a00:1450:4864:20::543; helo=mail-ed1-x543.google.com; envelope-from=ard.biesheuvel@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-ed1-x543.google.com (mail-ed1-x543.google.com [IPv6:2a00:1450:4864:20::543]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id C00DE2194D3B3 for ; Fri, 4 Jan 2019 06:43:50 -0800 (PST) Received: by mail-ed1-x543.google.com with SMTP id g22so31952104edr.7 for ; Fri, 04 Jan 2019 06:43:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=zn1dvLGP15CgGQEpybD9sjdhPiVVZZ9wEnP+D7gMSro=; b=aCoTvEBNhEsDxpvWjj6ylRIIMhplUkCwnelGUEvEBWK38eclFiqxrEDZ7wHLurGlHN gUSPmNqINWQZOPMrxfDICp4lNa80fmMtA/gXpLfk6NPWNLW7GWWbxxQjeZrL6WiOc0Oy cj3hw/2Ki2idaB0Iaow/WfZfhkh/pwEOh1Tvc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=zn1dvLGP15CgGQEpybD9sjdhPiVVZZ9wEnP+D7gMSro=; b=BwBIhnpLj9bHuEw0BfdjHJd93V+TpWC6TkDbse9YHoVYdRc/r5OEHG7/qlL0YayQbW c1yYXRJn96YQKxBGWSPAkPsyTf59LDU83v11Pxj8flzEf3K2RbOCxgrZNXxlaMRU4hCJ cKCcUVEToVem19XvKBN0gTvYMN/f34aE2MaSAnPb4ySBrB2Nz5hq4dSwtOYNCMDjSn26 hWZsH4J0U+XYYO3Q7X/1ciUZsgf+wakFRn8TaexxD2Nu7qiPT0kxKmOB970zGHa77scn ooXjwXQPdln/3G0EezuU0xB2SWT7F0lKF5PgjMPKEx2YOySQAAnLXuWqRuyudItWlK8L c57w== X-Gm-Message-State: AA+aEWb5f7/YwM2gjXsnkaiIMb76BzpFD/unb3fb5h3moi3kXHU8qsss wEb3dRR2JhcTjQvmOiIUf+EndoVUW0W/JQ== X-Received: by 2002:a17:906:2972:: with SMTP id x18-v6mr39695330ejd.28.1546613028920; Fri, 04 Jan 2019 06:43:48 -0800 (PST) Received: from dogfood.home ([2a01:cb1d:112:6f00:183a:9013:d5a3:37a8]) by smtp.gmail.com with ESMTPSA id q16sm21608226eds.60.2019.01.04.06.43.47 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 04 Jan 2019 06:43:47 -0800 (PST) From: Ard Biesheuvel To: edk2-devel@lists.01.org Date: Fri, 4 Jan 2019 15:43:33 +0100 Message-Id: <20190104144336.8941-5-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190104144336.8941-1-ard.biesheuvel@linaro.org> References: <20190104144336.8941-1-ard.biesheuvel@linaro.org> Subject: [edk2] [PATCH edk2-platforms 4/7] Silicon/SynQuacer/Fip006Dxe: use proper accessor for unaligned access X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" This code may execute in SMM context, where unaligned accesses are not permitted. So use ReadUnaligned32() instead of performing a direct UINT32* cast. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ard Biesheuvel --- Silicon/Socionext/SynQuacer/Drivers/Fip006Dxe/NorFlash.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.17.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel diff --git a/Silicon/Socionext/SynQuacer/Drivers/Fip006Dxe/NorFlash.c b/Silicon/Socionext/SynQuacer/Drivers/Fip006Dxe/NorFlash.c index 2134739bfba9..d45c8d9b35d2 100644 --- a/Silicon/Socionext/SynQuacer/Drivers/Fip006Dxe/NorFlash.c +++ b/Silicon/Socionext/SynQuacer/Drivers/Fip006Dxe/NorFlash.c @@ -841,7 +841,7 @@ NorFlashWriteSingleBlock ( BlockSize); // The word of data that is to be written. - TmpBuf = *((UINT32*)(Buffer + (*NumBytes - BytesToWrite))); + TmpBuf = ReadUnaligned32 ((UINT32 *)(Buffer + (*NumBytes - BytesToWrite))); // First do word aligned chunks. if ((CurOffset & 0x3) == 0) {