From patchwork Tue Nov 7 11:31:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilias Apalodimas X-Patchwork-Id: 741861 Delivered-To: patch@linaro.org Received: by 2002:adf:fd90:0:b0:32d:baff:b0ca with SMTP id d16csp1565025wrr; Tue, 7 Nov 2023 03:31:42 -0800 (PST) X-Google-Smtp-Source: AGHT+IF6YaQ0H8yn7nayrxge8OHMAeRf9xwauEI2FbpjsJH78i6kKk9Z9+i7fsSIrcq25MdM/usb X-Received: by 2002:aa7:c441:0:b0:52f:b00a:99be with SMTP id n1-20020aa7c441000000b0052fb00a99bemr25477340edr.33.1699356702695; Tue, 07 Nov 2023 03:31:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699356702; cv=none; d=google.com; s=arc-20160816; b=Xu6MHcYpaTidKNm/MrLSJRsmJcfJ2SLlmsgq2BjNhiQ/532oN5zXS8cSO8vYWwjpd3 smKOejhqw9yAmKjSblFH8einrlx+awcm7DfEeNy91GNo1CrCz+/b7SwzY4OxAx0hcAFS /bjLVLSMylhnMt7XY5iE8FNElLKBtkeXpaOpozs//2nrZ5igQyOpdUc95VqMsG2EZWoa RkXrdruRAX7IX1EGRwEH6er6iI8E5w4c6FZhIvGbfErww9YgCcNMgCKmFILSgn9SHKvY aPSXXGORgjlVZ46i8/3Po6s5G5h93lXBdy8sdCt4y86GBKu2KYZ7INLb6GTSt3cjOZpz 8k8A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:message-id:date:subject:cc:to:from:dkim-signature; bh=zvE3CNX8cVQQgczU0mbrH+4yqzKuXd3Fi9J02FukOXM=; fh=H8VOIwzcyLsrtWf30yIWXzQBSmjvLBf3UywLg/R/0ek=; b=obFYxFQl/RT5EKP0iniWFhSUGcJ44T+RkgdeRuyNImogmWW6z/NyYhwsiiigMm3vWv SFTK8CH4+KMeHnpCioNoAJ69g33oW2lmqRjzUEpcy6AgB2ibURz9hSb9hrf1q/u1mq91 IOVvgUbuiKNMobaR3ilAaY6SfJxSrPPztxLWoVgWgRIQjksOzphKYYruVE7kUfdk6Q/i uXRx5zZsDUZ+Y18UXO0lYmMOhxkpU7Ifyv/8qAIIcOw+ACqonoY+64HKaRUh0zoYZ16R s3rYrJXBGFGPk7L3cLjabu+3oUHPA+znXTKWsQSygZxpkc8p3hIl8CbvnNJ1SUS2Dk3L C+fg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=hcSwoKJv; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [2a01:238:438b:c500:173d:9f52:ddab:ee01]) by mx.google.com with ESMTPS id s17-20020a50d491000000b00540f243db3csi5057874edi.490.2023.11.07.03.31.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Nov 2023 03:31:42 -0800 (PST) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=hcSwoKJv; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 3982387016; Tue, 7 Nov 2023 12:31:41 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="hcSwoKJv"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 06B0187030; Tue, 7 Nov 2023 12:31:40 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-ed1-x52c.google.com (mail-ed1-x52c.google.com [IPv6:2a00:1450:4864:20::52c]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 2AFAB86996 for ; Tue, 7 Nov 2023 12:31:38 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=ilias.apalodimas@linaro.org Received: by mail-ed1-x52c.google.com with SMTP id 4fb4d7f45d1cf-542d654d03cso9175110a12.1 for ; Tue, 07 Nov 2023 03:31:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1699356698; x=1699961498; darn=lists.denx.de; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=zvE3CNX8cVQQgczU0mbrH+4yqzKuXd3Fi9J02FukOXM=; b=hcSwoKJvKGtLy6rkIMMeseQDUTOvAXcuFFCRsLazboijkz2A2AvaUPH4fLHfefMEvl Dt3Nx6WSm2p1Wshb59LsA7TSJbeBSnZP65Icfsnqy8JiTQIlkBKNV3Swz56wunduthde yH1Pg8IDip+MAd3y55bVumhY038YcJXT+7DZVhuwBhyvBN7QZmssgCAw6yQoUNemkUyC xipS2wmY1hBHJIDdNojTbg/akkrpHmrm2el1HfNqAsOoMHRnBASEQORx14mySNvHamuo cTtMi+U5Mi1M232FbaPPOO4IPG1F+Wk3I4A8Xx7wwL0sk2qzHoFuFVy++6sOxsWo4XTn K41A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699356698; x=1699961498; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=zvE3CNX8cVQQgczU0mbrH+4yqzKuXd3Fi9J02FukOXM=; b=VrT4kZgrm8DV+SRe2IYC29DvrRhverZXwOHu07NsfhPEyjo29cgszPb/HNaJFFkXlj 60p7dKTbWUZRemlMpEDrKgVRDfq29HQNvhZDFm77QWRxj58GlvkWzCBkfodKeZN5Uj12 MLWqv2ePpMysp0w5TJnXwFuh1GTRkq31FTEaBGoB5mLD1onu6EsripZBQMAwqc2I1WKd TmXu/R2zuk2b7V0w1gB9z20vtOStdjUAozRWevPps9DdAz3AIL9aNhHuP+09fQ959dJG omfsXMdwa3BCXSIxy66+r8JUpU9WVlCMv5MtbChJr7/tbI/vFMxQLTLG2cBI6wMBmm5J j9BA== X-Gm-Message-State: AOJu0Yx+LGmRRa8O29Sgcw3239lRm0x7N/9an94Be555K0PcBM5GSP4b s92uJcB25g+OBDX9Xg5Ic28ARfpZ/CG7xr+yW+Q= X-Received: by 2002:aa7:c494:0:b0:53d:e5d7:4148 with SMTP id m20-20020aa7c494000000b0053de5d74148mr30109445edq.1.1699356697706; Tue, 07 Nov 2023 03:31:37 -0800 (PST) Received: from localhost.localdomain (ppp046103219117.access.hol.gr. [46.103.219.117]) by smtp.gmail.com with ESMTPSA id q22-20020a50aa96000000b0053e3d8f1d9fsm5415675edc.67.2023.11.07.03.31.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Nov 2023 03:31:37 -0800 (PST) From: Ilias Apalodimas To: u-boot@lists.denx.de Cc: eajames@linux.ibm.com, Ilias Apalodimas , Heinrich Schuchardt Subject: [PATCH] efi_loader: Correctly account the SCRTM event creation Date: Tue, 7 Nov 2023 13:31:34 +0200 Message-Id: <20231107113134.81029-1-ilias.apalodimas@linaro.org> X-Mailer: git-send-email 2.40.1 MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean The result of efi_append_scrtm_version() is overwritten before anyone checks its result. Check it and exit the function on failures Addresses-Coverity-ID: 467399 Code maintainability issues (UNUSED_VALUE) Fixes: commit 97707f12fdab ("tpm: Support boot measurements") Signed-off-by: Ilias Apalodimas Reviewed-by: Heinrich Schuchardt --- lib/efi_loader/efi_tcg2.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/efi_loader/efi_tcg2.c b/lib/efi_loader/efi_tcg2.c index 2eaa12b83b16..463ea4c15416 100644 --- a/lib/efi_loader/efi_tcg2.c +++ b/lib/efi_loader/efi_tcg2.c @@ -944,8 +944,11 @@ static efi_status_t efi_init_event_log(void) * Add SCRTM version to the log if previous firmmware * doesn't pass an eventlog. */ - if (!elog.found) + if (!elog.found) { ret = efi_append_scrtm_version(dev); + if (ret != EFI_SUCCESS) + goto free_pool; + } ret = create_final_event(); if (ret != EFI_SUCCESS)