From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2a00:1450:400c:c0c::243; helo=mail-wr0-x243.google.com; envelope-from=ard.biesheuvel@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-wr0-x243.google.com (mail-wr0-x243.google.com [IPv6:2a00:1450:400c:c0c::243]) (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 E5F6020956060 for ; Fri, 16 Mar 2018 09:07:09 -0700 (PDT) Received: by mail-wr0-x243.google.com with SMTP id v65so12209017wrc.11 for ; Fri, 16 Mar 2018 09:13:35 -0700 (PDT) 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=UP79KEtGjrsXu1BisqMygG3vBJQhUaVzyXwNOgD7MbY=; b=C/sIPMqBPcErrjKd5l9y049N4UtUdMd2LrK/rW5w6L738aVe9f4vjNjuVBYbilF2wF tWPeMTnANHt5If5Ij6vgzLXAliQe/9JQiFxhJ6ix6mfc1mayhAiFQgglsrdepToOBM/a DS3r8dUeKO+p58tDqLBKTip7ACsVwSBNBH7UE= 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=UP79KEtGjrsXu1BisqMygG3vBJQhUaVzyXwNOgD7MbY=; b=EcmFbCadx6yJrxf1Rj6HBnUJOE+UGSy8VLMc9bzQO67CUN+7LDKB72QDCMQiMUgFDP ysYsP1bGvV9T0qsoGG1bcTQ2G2QZd+AQm7SKpn6nxXL4p2+yCRwmH0xAN1NAHl7xYEFQ fh9XspRCsy4LN4seWI0a/DBcPI8Rz+bTrhrR1iY/N+0nVPl8tt8lSCWIsHdTzaeENjGc 7AjoAX8BhCq2nPKuXfdFY4h3x9cjZRHiXJ5Z4M3jZzWkLz0tdKkhZy4y+noo9fiCv8Lj 7nOscUwoXnsbA7YdPzUHyMgGilWMpA9yYRTB83Vg5/4yxdrskSw5H6WTYHJSe+2wJmm9 V5tQ== X-Gm-Message-State: AElRT7GTeaWzP7rySnViOSQQOk8ZkotA2lEXRAcvqDnWxuMjwjEkwNfS Be3vztN+RCbKjHEk/okeqdH+PZlt/uc= X-Google-Smtp-Source: AG47ELtQrVKyWZkZLC25SMfTkRKYpxQL7zwFP/2j0it06DN9Ok70pA4lGFrU3/v45sIcqQAidSJRbA== X-Received: by 10.223.136.183 with SMTP id f52mr2060331wrf.74.1521216813491; Fri, 16 Mar 2018 09:13:33 -0700 (PDT) Received: from localhost.localdomain ([105.142.191.63]) by smtp.gmail.com with ESMTPSA id n8sm7876242wrf.12.2018.03.16.09.13.31 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 16 Mar 2018 09:13:32 -0700 (PDT) From: Ard Biesheuvel To: edk2-devel@lists.01.org Cc: leif.lindholm@linaro.org, Ard Biesheuvel Date: Fri, 16 Mar 2018 16:13:18 +0000 Message-Id: <20180316161322.6756-3-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.15.1 In-Reply-To: <20180316161322.6756-1-ard.biesheuvel@linaro.org> References: <20180316161322.6756-1-ard.biesheuvel@linaro.org> Subject: [RFC PATCH edk2-platforms 2/6] Silicon/SynQuacerPlatformFlashAccessLib: don't dereference FVB header fields X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 16 Mar 2018 16:07:10 -0000 When we updated the capsule definition to cover the ARM Trusted Firmware binary image as well as the firmware volume containing the EDK2 code, we failed to recognize that the start of the image no longer constitutes a Firmware Volume header, and so we should not interpret the data as such. Note that this makes the FVB protocol slighty less appropriate as the abstraction to use to write this data, but given that there does not appear to be a better match (disk I/O, block I/O), let's stick with it for now, but require the base address to match the capsule's target address exactly rather than reading the size of the FV from the header. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ard Biesheuvel --- Silicon/Socionext/SynQuacer/Library/SynQuacerPlatformFlashAccessLib/SynQuacerPlatformFlashAccessLib.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/Silicon/Socionext/SynQuacer/Library/SynQuacerPlatformFlashAccessLib/SynQuacerPlatformFlashAccessLib.c b/Silicon/Socionext/SynQuacer/Library/SynQuacerPlatformFlashAccessLib/SynQuacerPlatformFlashAccessLib.c index 1af4abc16aa5..82fe3f74aa7f 100644 --- a/Silicon/Socionext/SynQuacer/Library/SynQuacerPlatformFlashAccessLib/SynQuacerPlatformFlashAccessLib.c +++ b/Silicon/Socionext/SynQuacer/Library/SynQuacerPlatformFlashAccessLib/SynQuacerPlatformFlashAccessLib.c @@ -53,7 +53,6 @@ GetFvbByAddress ( UINTN HandleCount; UINTN Index; EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *Fvb; - EFI_FIRMWARE_VOLUME_HEADER *FwVolHeader; EFI_FVB_ATTRIBUTES_2 Attributes; // @@ -103,8 +102,7 @@ GetFvbByAddress ( continue; } - FwVolHeader = (EFI_FIRMWARE_VOLUME_HEADER *) ((UINTN) *FvbBaseAddress); - if ((Address >= *FvbBaseAddress) && (Address <= (*FvbBaseAddress + FwVolHeader->FvLength))) { + if (Address == *FvbBaseAddress) { *OutFvb = Fvb; Status = EFI_SUCCESS; break; -- 2.15.1