From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by mx.groups.io with SMTP id smtpd.web12.20997.1629097845954089020 for ; Mon, 16 Aug 2021 00:10:46 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=KTjuskoV; spf=pass (domain: kernel.org, ip: 198.145.29.99, mailfrom: ardb@kernel.org) Received: by mail.kernel.org (Postfix) with ESMTPSA id 23B8A61AA4 for ; Mon, 16 Aug 2021 07:10:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1629097845; bh=vSYVO7YaRnkUHw5YqZNOqEIrQMCP14WgmVvilhDTf30=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=KTjuskoVdAmanqOoOfBUs4n2Uv7nabC96U9xd2Th9VqsXx51RGa/0mu+XzhMF/6b8 EkJU/vCVm+c4LKq5kCtrZXrWXToauohJbrGCiQtaQMQMmEKVwxHUUzp5MeuYH+lOnC 34WnK85xTHiwb/OO9nsuIbiLt2wi8FA8DRTrvRzq0tjDT+AwAsg2NGofbOUne/WwCc MTBE1DH7cIx+OBHWu4i5E9MpgP+HM3W4EWlIkhHwaGSbf8NI0n4eqZcd4Y/gztDouu Kps1/IclIkXUYO+um/coNI1/1z72QrWDFXwUdMV6TiL6ZgqtuJ2iC8yggK2Giqs8NG ZZSVb61D6cuRg== Received: by mail-oi1-f179.google.com with SMTP id u25so25448380oiv.5 for ; Mon, 16 Aug 2021 00:10:45 -0700 (PDT) X-Gm-Message-State: AOAM531LoRNRPU9y/WBweOnTzWQnJ5Zi/tzY8caF0po6xq+qG6TEytdk 3n+yyYtSuaykK0xN5+DIcQV0LGsu4QC2H3fmVoY= X-Google-Smtp-Source: ABdhPJzMFOnsX67JkfPwtt8+zTT7mQIeT2ulheBvWadZQakM6GvsrT4f89zTDcHEUWJODg75KIF35yDNPjGtHWgFrZM= X-Received: by 2002:aca:ea54:: with SMTP id i81mr10327241oih.174.1629097844448; Mon, 16 Aug 2021 00:10:44 -0700 (PDT) MIME-Version: 1.0 References: <20210813050508.28232-1-jeremy.linton@arm.com> In-Reply-To: <20210813050508.28232-1-jeremy.linton@arm.com> From: "Ard Biesheuvel" Date: Mon, 16 Aug 2021 09:10:33 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] EmbeddedPkg/NonCoherentDmaLib: Avoid dereferencing unset Map field To: Jeremy Linton , "Liming Gao (Byosoft address)" Cc: edk2-devel-groups-io , Peter Batard , Ard Biesheuvel , Leif Lindholm , Andrei Warkentin , Sunny Wang , Samer El-Haj-Mahmoud Content-Type: text/plain; charset="UTF-8" On Fri, 13 Aug 2021 at 07:05, Jeremy Linton wrote: > > Map->Operation is used to select whether a DMA region that > is being bounced has the source buffer copied to it. Except > Map->Operation isn't yet set, so the behavior is somewhat > random. Instead use the passed in Operation parameter. > > Signed-off-by: Jeremy Linton Thanks for fixing this. Liming, I am not sure what stage of the release cycle we are currently in, but this fix should go in right away anyway. Unless any objections are raised, I will merge it later today. I will leave it to you to decide how this affects the stable tag release schedule. -- Ard. > --- > EmbeddedPkg/Library/NonCoherentDmaLib/NonCoherentDmaLib.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/EmbeddedPkg/Library/NonCoherentDmaLib/NonCoherentDmaLib.c b/EmbeddedPkg/Library/NonCoherentDmaLib/NonCoherentDmaLib.c > index 9c8ef5bfb5..1aec86fffd 100644 > --- a/EmbeddedPkg/Library/NonCoherentDmaLib/NonCoherentDmaLib.c > +++ b/EmbeddedPkg/Library/NonCoherentDmaLib/NonCoherentDmaLib.c > @@ -224,7 +224,7 @@ DmaMap ( > goto FreeMapInfo; > } > > - if (Map->Operation == MapOperationBusMasterRead) { > + if (Operation == MapOperationBusMasterRead) { > CopyMem (Map->BufferAddress, (VOID *)(UINTN)HostAddress, *NumberOfBytes); > } > mCpu->FlushDataCache (mCpu, (UINTN)Map->BufferAddress, AllocSize, > -- > 2.13.7 >