From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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-Google-Smtp-Source: AFSGD/UPkd9YlyVVTGCM1EU3J32ysI+dtHCdeedq1Qkhpu0vxNSBXFJ8TpjAE5vhKNf+lmQmQ8N9xg== 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: [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: , X-List-Received-Date: Fri, 04 Jan 2019 14:43:51 -0000 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(-) 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) { -- 2.17.1