From nobody Thu Mar 28 21:03:02 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+61421+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+61421+1787277+3901457@groups.io ARC-Seal: i=1; a=rsa-sha256; t=1592408316; cv=none; d=zohomail.com; s=zohoarc; b=D/epYgWmcHVdLeJGYFTr5CT/hfiofmyRsCAHIpH9rj68yzZeKtRdr5fAJE4JAqXQ3uPh3RDZI+9xpDpdsW5AIbrwnR0a7Aj5ucqcWxhFhFFjwXixwlcT9Y9mn7mffio20viSS166wOyNhzzFnjuEj3+z/kiFEzw9x2ClCfyPqzs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1592408316; h=Content-Transfer-Encoding:Cc:Date:From:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Sender:Subject:To; bh=nzyVVPI3Lt1HBS5q9nzQ6ml+w+1B473Za3L3m02cofo=; b=E9sDLuLoncraPnQ+bAgMnqQLdUttKSRRf+Le7ATGBJ+T3//uZU9u+xwIV7gZpurPu5ivgOEyxm2eo+umQCnXw0jHucpMTOhM3/5BL9Bffqpr/Ynk8xRV7rE6PnPcyBlLQwBqCgbfsmkXA7dEfOdGVVfPxys2Fy0/kL0s1HUDgj0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+61421+1787277+3901457@groups.io Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1592408316670748.8367498359352; Wed, 17 Jun 2020 08:38:36 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id 0x2KYY1788612xr5JDKuh3D1; Wed, 17 Jun 2020 08:38:36 -0700 X-Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web11.10509.1592408315260448763 for ; Wed, 17 Jun 2020 08:38:35 -0700 X-Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id D18A51045; Wed, 17 Jun 2020 08:38:33 -0700 (PDT) X-Received: from dogfood.home (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 975593F73C; Wed, 17 Jun 2020 08:38:32 -0700 (PDT) From: "Ard Biesheuvel" To: devel@edk2.groups.io Cc: leif@nuviainc.com, pete@akeo.ie, awarkentin@vmware.com, jeremy.linton@arm.com, Samer.El-Haj-Mahmoud@arm.com, Ard Biesheuvel Subject: [edk2-devel] [PATCH] EmbeddedPkg/NonCoherentDmaLib: avoid dereferencing bogus buffer address Date: Wed, 17 Jun 2020 17:38:24 +0200 Message-Id: <20200617153824.1175136-1-ard.biesheuvel@arm.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,ard.biesheuvel@arm.com X-Gm-Message-State: 7ffd8WEowllowhIljMYxU64Ex1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1592408316; bh=aiP7aXjR7qYQf/yWEUhZ57RlCLCCNyvnmVl41Agvp18=; h=Cc:Date:From:Reply-To:Subject:To; b=dz0m/EOPXh9scLeeFeHhEahROUESQscP7jjS1mYo8w470Xfec/iWFxXRKbCqEoXVY5v BVhRKVrn5MoIWd2KI3okjcyCuxzljdKAXvPmzdUUBKJXYFbFDl/XswKdu3IsRmwlhD+s1 1WyVdvDkjsANH6t0VVvIKJo9c0cyWVkQNcU= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" The bounce buffering code in NonCoherentDmaLib copies data into the bounce buffer using CopyMem(), but passes Map->HostAddress as the source of the copy before it has been assigned its correct value. Signed-off-by: Ard Biesheuvel Reviewed-by: Andrei Warkentin Reviewed-by: Leif Lindholm --- EmbeddedPkg/Library/NonCoherentDmaLib/NonCoherentDmaLib.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/EmbeddedPkg/Library/NonCoherentDmaLib/NonCoherentDmaLib.c b/Em= beddedPkg/Library/NonCoherentDmaLib/NonCoherentDmaLib.c index 115345765435..9c8ef5bfb533 100644 --- a/EmbeddedPkg/Library/NonCoherentDmaLib/NonCoherentDmaLib.c +++ b/EmbeddedPkg/Library/NonCoherentDmaLib/NonCoherentDmaLib.c @@ -225,8 +225,7 @@ DmaMap ( } =20 if (Map->Operation =3D=3D MapOperationBusMasterRead) { - CopyMem (Map->BufferAddress, (VOID *)(UINTN)Map->HostAddress, - *NumberOfBytes); + CopyMem (Map->BufferAddress, (VOID *)(UINTN)HostAddress, *NumberOfBy= tes); } mCpu->FlushDataCache (mCpu, (UINTN)Map->BufferAddress, AllocSize, EfiCpuFlushTypeWriteBack); --=20 2.27.0 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#61421): https://edk2.groups.io/g/devel/message/61421 Mute This Topic: https://groups.io/mt/74939973/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-