From patchwork Thu Apr 30 12:04:07 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 47808 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wg0-f69.google.com (mail-wg0-f69.google.com [74.125.82.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 7639F2121F for ; Thu, 30 Apr 2015 12:04:39 +0000 (UTC) Received: by wgtl5 with SMTP id l5sf14466719wgt.1 for ; Thu, 30 Apr 2015 05:04:38 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:date:message-id:subject :precedence:reply-to:list-id:list-unsubscribe:list-archive:list-post :list-help:list-subscribe:mime-version:content-type :content-transfer-encoding:errors-to:x-original-sender :x-original-authentication-results:mailing-list; bh=QdbT/mMpNrYWZW1L5FD+NCE6/BQUbPOM95hvjAiTPlI=; b=Hoza1Yk1K9r9KKRkNot7xrnUd9LTv1Yx4fUgFsfwayuZu4/WE04WPL+JekxWRzkb7s +RJnIokHMQRdo0MfDBffnmvAes9eMiMjk2IyyusT57TwVuwhogQWI5MtOh6gvdFyF3gC ncnQZr9foOjZ8EMZP65SM8IxiHck12gskVz2JUXg9gyvTfG5Ie6pMOwM1KkeYuW5/y9I nCauH1rdi9qshK1sG0gVMSOsOauzIeoeAbkQutbdkRBUd7aT9tgAjLGNrtXn0iqKX6W6 XL149cSGsnXr+WkRk8zx01Tqtw/ZxtWxHug30UZkF1URKr3XNrQgVk0NEK7xcOfGH3GW 9p/Q== X-Gm-Message-State: ALoCoQlfjLuxw5ZtTpq0cfE63G7G13Ga2iVSElg0HUIlVwYSrPIMmHsz6jij05DIQI7IVC+ttjB+ X-Received: by 10.112.162.228 with SMTP id yd4mr2328007lbb.8.1430395478538; Thu, 30 Apr 2015 05:04:38 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.36.227 with SMTP id t3ls359606laj.72.gmail; Thu, 30 Apr 2015 05:04:38 -0700 (PDT) X-Received: by 10.112.140.9 with SMTP id rc9mr3619799lbb.14.1430395478387; Thu, 30 Apr 2015 05:04:38 -0700 (PDT) Received: from mail-lb0-f171.google.com (mail-lb0-f171.google.com. [209.85.217.171]) by mx.google.com with ESMTPS id q6si1619680lby.85.2015.04.30.05.04.38 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 30 Apr 2015 05:04:38 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.171 as permitted sender) client-ip=209.85.217.171; Received: by lbbuc2 with SMTP id uc2so42608318lbb.2 for ; Thu, 30 Apr 2015 05:04:38 -0700 (PDT) X-Received: by 10.152.29.161 with SMTP id l1mr3471352lah.76.1430395478295; Thu, 30 Apr 2015 05:04:38 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.67.65 with SMTP id l1csp3069468lbt; Thu, 30 Apr 2015 05:04:37 -0700 (PDT) X-Received: by 10.50.45.103 with SMTP id l7mr2983179igm.41.1430395476909; Thu, 30 Apr 2015 05:04:36 -0700 (PDT) Received: from lists.sourceforge.net (lists.sourceforge.net. [216.34.181.88]) by mx.google.com with ESMTPS id r97si1526606ioi.19.2015.04.30.05.04.35 (version=TLSv1 cipher=RC4-SHA bits=128/128); Thu, 30 Apr 2015 05:04:36 -0700 (PDT) Received-SPF: pass (google.com: domain of edk2-devel-bounces@lists.sourceforge.net designates 216.34.181.88 as permitted sender) client-ip=216.34.181.88; Received: from localhost ([127.0.0.1] helo=sfs-ml-3.v29.ch3.sourceforge.com) by sfs-ml-3.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1YnnCb-0007ai-D5; Thu, 30 Apr 2015 12:04:25 +0000 Received: from sog-mx-4.v43.ch3.sourceforge.com ([172.29.43.194] helo=mx.sourceforge.net) by sfs-ml-3.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1YnnCa-0007ad-MT for edk2-devel@lists.sourceforge.net; Thu, 30 Apr 2015 12:04:24 +0000 Received-SPF: pass (sog-mx-4.v43.ch3.sourceforge.com: domain of linaro.org designates 209.85.212.171 as permitted sender) client-ip=209.85.212.171; envelope-from=ard.biesheuvel@linaro.org; helo=mail-wi0-f171.google.com; Received: from mail-wi0-f171.google.com ([209.85.212.171]) by sog-mx-4.v43.ch3.sourceforge.com with esmtps (TLSv1:RC4-SHA:128) (Exim 4.76) id 1YnnCY-0002GC-RU for edk2-devel@lists.sourceforge.net; Thu, 30 Apr 2015 12:04:24 +0000 Received: by wief7 with SMTP id f7so11483630wie.0 for ; Thu, 30 Apr 2015 05:04:16 -0700 (PDT) X-Received: by 10.180.208.42 with SMTP id mb10mr4091015wic.80.1430395456824; Thu, 30 Apr 2015 05:04:16 -0700 (PDT) Received: from ards-macbook-pro.local (cag06-7-83-153-85-71.fbx.proxad.net. [83.153.85.71]) by mx.google.com with ESMTPSA id k2sm2180631wif.3.2015.04.30.05.04.14 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 30 Apr 2015 05:04:15 -0700 (PDT) From: Ard Biesheuvel To: feng.tian@intel.com, edk2-devel@lists.sourceforge.net Date: Thu, 30 Apr 2015 14:04:07 +0200 Message-Id: <1430395447-4868-1-git-send-email-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 1.9.1 X-Spam-Score: -1.5 (-) X-Spam-Report: Spam Filtering performed by mx.sourceforge.net. See http://spamassassin.org/tag/ for more details. -1.5 SPF_CHECK_PASS SPF reports sender host as permitted sender for sender-domain -0.0 SPF_PASS SPF: sender matches SPF record X-Headers-End: 1YnnCY-0002GC-RU Subject: [edk2] [PATCH] MdeModulePkg: avoid unaligned writes in PcdDxe driver X-BeenThere: edk2-devel@lists.sourceforge.net X-Mailman-Version: 2.1.9 Precedence: list Reply-To: edk2-devel@lists.sourceforge.net List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , MIME-Version: 1.0 Errors-To: edk2-devel-bounces@lists.sourceforge.net X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: ard.biesheuvel@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.171 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 InternalData may not be aligned to the size of the type we are writing, so use WriteUnalignedXX() instead. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ard Biesheuvel --- MdeModulePkg/Universal/PCD/Dxe/Service.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/MdeModulePkg/Universal/PCD/Dxe/Service.c b/MdeModulePkg/Universal/PCD/Dxe/Service.c index 9b4701bdd749..f071fc58361b 100644 --- a/MdeModulePkg/Universal/PCD/Dxe/Service.c +++ b/MdeModulePkg/Universal/PCD/Dxe/Service.c @@ -1259,15 +1259,15 @@ SetWorker ( break; case sizeof(UINT16): - *((UINT16 *) InternalData) = *((UINT16 *) Data); + WriteUnaligned16 (InternalData, *((UINT16 *) Data)); break; case sizeof(UINT32): - *((UINT32 *) InternalData) = *((UINT32 *) Data); + WriteUnaligned32 (InternalData, *((UINT32 *) Data)); break; case sizeof(UINT64): - *((UINT64 *) InternalData) = *((UINT64 *) Data); + WriteUnaligned64 (InternalData, *((UINT64 *) Data)); break; default: