From patchwork Sun Jun 23 11:48:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilias Apalodimas X-Patchwork-Id: 806892 Delivered-To: patch@linaro.org Received: by 2002:a5d:508d:0:b0:362:4979:7f74 with SMTP id a13csp1472187wrt; Sun, 23 Jun 2024 04:49:00 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVn/hqhHc9Xxc1RQqAYNNum1+TU5tBXS2dnT7F3ChLWPOULYZZOF76DFS7hXwgm5ehR6CJhzGYrTSlVucQZ0EDu X-Google-Smtp-Source: AGHT+IGThwGeDwb5MdTy7Np0LSZ75cLxNhQ52Dk+AIZ6IBcDvx70X2QOxNenZHvm32QEtDK4o3vP X-Received: by 2002:a17:906:6a85:b0:a72:40b4:c845 with SMTP id a640c23a62f3a-a7242cdb11emr165961966b.51.1719143340369; Sun, 23 Jun 2024 04:49:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1719143340; cv=none; d=google.com; s=arc-20160816; b=mDwtpkDasdghhAlg8Xy/2AeeExLJQuS21iBg4g6wiObMpAcCPbKwSbOCHaG1iwMBZp oN3R98Q+AEwg9evJOA5Qj94iY3MMoxUK5Cavd0o99K92D0ppl1soZLIPY+xGlqYwVZeY vEPST1uHgrtxWghQNg5niiAwvO/Gi5HKZEkHJs83URN8BTpedgDNxtaAyFVWQn4Hqy6Q YqmRWE7Zl3KfsqV2JdL5hifod9W5/aEnQv0oEWReyZwmyGhr3U0X0YV92u3XmtdJMQws qRTzchhrc09xmOfJ24/EI1fpfQVspnqXcsXoX+8bubXxXHUiFkxpY5FNPi88ykGJq3of evJQ== 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:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=qYtWenobQtR5aOmVQ8zApI9sPDX6wCJfo/xL6dG1i0Q=; fh=A0dO6JkRWtR3CCaiIMPbSTXofuM0bn7Boeal2ZV/vxQ=; b=xF32nCm6+GrAnafHbhTSaiRzJUR2sTCnrzJy7GKrYuw/5l+FsaNpDoEFW09v3VYqyo x/7kR26qTBBk1AiYOhKARUqd4wmzGyupo6q0l7VJAENDlNj1wQwvmkDZdc6Xqd7uPAqU iGj99rBmX8WRslCcMoSNO3JeuIduvoV4xMhrC1PQ2XUjFD53CimF5y7aEsE4smEssk/0 kvyz5JpBhxIyIRymAMl8JIZc6z8EAzQEKalv5VfpJxIB/yyZtedqkK7fR0Zbcul2i5KO maWlNv2vt26Isva5uoBrwGDEememgl2vUhpAbh0l2vuXu5ZGENExmLh8p75qxBgUay4s Z6KQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=xwuRG62P; 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 a640c23a62f3a-a724d8d8e2fsi40088566b.141.2024.06.23.04.48.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 23 Jun 2024 04:49:00 -0700 (PDT) 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=xwuRG62P; 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 EA59088327; Sun, 23 Jun 2024 13:48:51 +0200 (CEST) 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="xwuRG62P"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 7C7C1882E6; Sun, 23 Jun 2024 13:48:50 +0200 (CEST) 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 autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-ed1-x534.google.com (mail-ed1-x534.google.com [IPv6:2a00:1450:4864:20::534]) (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 868E9882B8 for ; Sun, 23 Jun 2024 13:48:48 +0200 (CEST) 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-x534.google.com with SMTP id 4fb4d7f45d1cf-57ccd1111aeso4073383a12.0 for ; Sun, 23 Jun 2024 04:48:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1719143328; x=1719748128; darn=lists.denx.de; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=qYtWenobQtR5aOmVQ8zApI9sPDX6wCJfo/xL6dG1i0Q=; b=xwuRG62PvUIl6Dmqijk2StAs2y4Auy6PYStAuevDUYHjptBKXgyWsnhudAOsSzjwVZ FA2OUqpTvfaJaHSIgaexFmZ5tgPx+tgdXn1b8Yg7KsPrOQqwXSBqjubVwYfanPyFSFAW lBaUzjMA0zSQecqCKgL+jidrvKpxQmGwgbt6Lf8ZQ8FymRPqgNdrQL9LcRvvrSnFKqqF IRHZc78Xp7xgqoXJDWwm7V/Ivix1ObF6DFidXzFMUzvhwvNF5fo6SCYhVyU+dgP/S3o9 XIlPGil2OZHDscNEQNh9GAgnz9Exl6rM6Ik4vy4gHbF2FvQesJ9r4QuQDsxYjRhXcPZI j4Qg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719143328; x=1719748128; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=qYtWenobQtR5aOmVQ8zApI9sPDX6wCJfo/xL6dG1i0Q=; b=QzugKZoUTdKMy8MsNXavuT7Ua/E5k7Stmp8Mtb5e7n6QY3wsu5IiprMO7XgaNQPf3+ clKUXumfMfeqU0PRPnAdM+yXt/EuH1K58WY5GDWFcIYVu1QioRq57L0QkZVUanHqYcic w7nQmPELjIGczSpr8AxXzvxIZQkNfAoyQqtYK//Ha92HLM+AhTPNqPuA3FkQo7kTeED5 IUrBS4kr4asPPlRGXFkPCnA+IYOXlwb82roiUvgxyem7zCS1szEE8mb4vEIqkOGQcgt3 joZ5WdXs+xAj9b9Ta9ZgNCnqLSnGhxUGHY3QfXeRGaM+Y4yHBpd8Fh28G5rWHD8MrMV2 XmKg== X-Forwarded-Encrypted: i=1; AJvYcCUprfb1LTV8c+67Awv+JBNJsH6PxrxTvqIPs7agH9vuoWBYNGl+n6xzNl2h82PR9EyJe2cxFB+/He/zvOnwIIShHNKO0A== X-Gm-Message-State: AOJu0YzRP4aKFb1HqHJK5dejRvz4nZ0Vd8zleIi74khha2r0xLu4s3+E O+y3Gs5L91IZWXXBy8FS0LbG/rBh6TvqEIU+84osRw6x0XO0kyK3JFqCGDFj9Xg= X-Received: by 2002:a50:cd1c:0:b0:57d:4ca4:61ba with SMTP id 4fb4d7f45d1cf-57d4ca46204mr1382805a12.10.1719143327615; Sun, 23 Jun 2024 04:48:47 -0700 (PDT) Received: from localhost.localdomain (ppp046103020130.access.hol.gr. [46.103.20.130]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-57d30534ffasm3402053a12.60.2024.06.23.04.48.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 23 Jun 2024 04:48:46 -0700 (PDT) From: Ilias Apalodimas To: xypron.glpk@gmx.de, sjg@chromium.org, trini@konsulko.com Cc: Ilias Apalodimas , Eddie James , Mattijs Korpershoek , Tim Harvey , Bin Meng , Sean Anderson , Manorit Chawdhry , Oleksandr Suvorov , Michal Simek , AKASHI Takahiro , Masahisa Kojima , u-boot@lists.denx.de Subject: [PATCH v2 1/8] tpm: fix the return code, if the eventlog buffer is full Date: Sun, 23 Jun 2024 14:48:11 +0300 Message-ID: <20240623114838.14639-2-ilias.apalodimas@linaro.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240623114838.14639-1-ilias.apalodimas@linaro.org> References: <20240623114838.14639-1-ilias.apalodimas@linaro.org> 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 We currently return 'No space left on device' if the eventlong buffer we allocated is not enough. On a similar check later on that function during the call to tcg2_log_init() we return 'No buffer space available'. So switch both error codes to -ENOBUFS since we are always checking a buffer and not a device. Fixes: commit 97707f12fdab ("tpm: Support boot measurements") Reviewed-by: Heinrich Schuchardt Signed-off-by: Ilias Apalodimas Reviewed-by: Simon Glass --- lib/tpm-v2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/tpm-v2.c b/lib/tpm-v2.c index a67daed2f3c1..91526af33acb 100644 --- a/lib/tpm-v2.c +++ b/lib/tpm-v2.c @@ -554,7 +554,7 @@ int tcg2_log_prepare_buffer(struct udevice *dev, struct tcg2_event_log *elog, if (elog->log_size) { if (log.found) { if (elog->log_size < log.log_position) - return -ENOSPC; + return -ENOBUFS; /* * Copy the discovered log into the user buffer