From patchwork Thu Jun 20 19:16:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilias Apalodimas X-Patchwork-Id: 806011 Delivered-To: patch@linaro.org Received: by 2002:a5d:508d:0:b0:362:4979:7f74 with SMTP id a13csp448918wrt; Thu, 20 Jun 2024 12:16:43 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCV7ac/8eMb7pEsxFiEvkdS9mmSRBVXb+59506W+XPj04SFX1t9Z8wHDBVnrYpDLDArSmgdx9oUIg0f8DZ8q8R7V X-Google-Smtp-Source: AGHT+IHBaQtBILUOt0NsZL1OtUqWO8ulefCcQ0q+CfZZbf9qU9kpKGk2QS3AueE4Ta/aJuL2KXEF X-Received: by 2002:adf:f6c5:0:b0:360:75b1:77fb with SMTP id ffacd0b85a97d-363170ed1abmr5442663f8f.8.1718911003292; Thu, 20 Jun 2024 12:16:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1718911003; cv=none; d=google.com; s=arc-20160816; b=oaqn/31jRZCfNRkjJilcZbKCIUdl2d4Rp1G7i+oLVj2Lu/VX0CAXmdMO64tjq6gTrF +mDM0APIqmA9DOmYGHCMzpYsp8J1U0zLQApvvqj9Cw4xEhaKnbjZbYmxhH3o824oqu8r 9K5IU9OFUmH8LK8rRZOz9DRVQhN1V4vJ6ujxznKRYaj1GRR2m8savwb9YgfY2dINoJxT 1q7BgF6/ALQF94uLm420XWpTt3PWuj9clccqto+eV2/NVPt27Z7+m6rkkSMc4r9oB53u D2PjyT80FQ0PuFPNbwdV9T8mVODEgi/ihlEsDXS8ZRqwrjHsOzh8RVToQZAoHatQKXh0 k5VA== 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=Q5PkW08WBuMQykPjUWpPxx8HLYDMJAfcp6bEzzIfQhg=; fh=AyIrvmZobbtXFRuN8AgmLEuie7m5f5Mgvs69zp5X9P4=; b=jWLAzQ4cBJ+KrLi8xfCe99lEJ24Pgmq/0cVX3k+5C7swF3g/D4sRLEOW9gNbzvCkow W2pEdc4/+uHMvsW9fKkXMtGiqDr/nEtVb94kcCO2ABcHKEIv/24vwRGVnnFslcwm3yMJ t5BOIuQ42nNS3FKB+qWxNX1jq97YSND8bUVxb0ifdNGDhCJBRZ6CL8VLn4+H4rSR2F4u +SYo6f1qhoAmZPLrDaqaQI6q2BqjN5tal5nZplSS8b6rdWntQUkx2wrX/2+Ag0Log4Ok gBePhHlUHNz2Dz4Ejr42egT/IVE0v6ym5lqPP2QOpo/NqmB4z/QmOQ7MOlclrUJ61EJq UKvA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=JLBv1AKp; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 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. [85.214.62.61]) by mx.google.com with ESMTPS id a640c23a62f3a-a6fcf4617e4si2435566b.159.2024.06.20.12.16.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Jun 2024 12:16:43 -0700 (PDT) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) client-ip=85.214.62.61; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=JLBv1AKp; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 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 35419884DC; Thu, 20 Jun 2024 21:16:42 +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="JLBv1AKp"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 6BD7288540; Thu, 20 Jun 2024 21:16:41 +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, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-ej1-x62c.google.com (mail-ej1-x62c.google.com [IPv6:2a00:1450:4864:20::62c]) (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 6C67B884DC for ; Thu, 20 Jun 2024 21:16:39 +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-ej1-x62c.google.com with SMTP id a640c23a62f3a-a6efacd25ecso69128366b.1 for ; Thu, 20 Jun 2024 12:16:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1718910999; x=1719515799; 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=Q5PkW08WBuMQykPjUWpPxx8HLYDMJAfcp6bEzzIfQhg=; b=JLBv1AKpFAOP4DbGFZ+/GQ0zhy059jkhNR6phOOeChOetlcAWKPhmlRLwqzy0zhPEt kPYdN5Qwn5EPpv9Je0Osqk7/DuK/oeyZWGJy66zapR+Vex7PDzZkJAisdqAlMcxEz0of dj62/FRNTFPPwjc9VrBDdy+ss6biMVYJRGGFM96pCmwJ3kUCvcXQB3jt5ROiMLpu5WKd 10q2chbfKwf/hCfl9dUirA/r7k4qYOWsJYZeIKdWnsvFfRPl3G1oMI5OEzpWKySEfQui jpnH2xmQ97jFFCd3co966uQcM0r0YkiS+wROktxMb6V48y2CsuRkAniyP6z4hwa5uJGM 64Bw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718910999; x=1719515799; 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=Q5PkW08WBuMQykPjUWpPxx8HLYDMJAfcp6bEzzIfQhg=; b=PZ4ebOqrUoMxSDDBCfyvXRbAHszi9DGko9fojcgL0iAG5LJ0pBp4qq2yQStpafons+ xVEQyH+4tonoMj0elMUdh4NdZBt34kKA7IDGpDhV5kbh6ueUkJRpOq0NMKxMwFmuYUwh z7Hf64tPoUGV3QN0YvfR5ZVq1BKW15+K/7YtoDU9WQD9ZubPUjVpPpNPv//WopKlGrWD j5nZhSNoZjd1bRu7tfJC1d15AANkpAStxlttrU0QJKTVeuf+xcT0DjhmUb3iA5nCkLpp qDegBFc6cRzyQ8QcdyPj/o0cRLtR6G49fDhiBxDDI5uefOPK7rBfqnWez8x74paY4vaD CeXg== X-Forwarded-Encrypted: i=1; AJvYcCVgKbhzG04L8seiHIOBTeLeEMUnSTucRatdK6WGxbGhaAw7H9k4O558PF1O1r7iseiDdQAyEQmeJW8iuMFikeu/J/UpcA== X-Gm-Message-State: AOJu0Yziha3MYG246Wwb0Fy+dCs6gYS/T91vk5UCEstin+cFQEBuVmUt 3RsDTl74QIZlEGT7L0dwYOVM9NW2AJQSnW+1fUN4sz+YCyKYqMVxEO3Ls1+7izU= X-Received: by 2002:a50:cc9d:0:b0:57c:6d89:eaef with SMTP id 4fb4d7f45d1cf-57d07e5224bmr5109882a12.18.1718910997982; Thu, 20 Jun 2024 12:16:37 -0700 (PDT) Received: from localhost.localdomain (ppp046103020130.access.hol.gr. [46.103.20.130]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-57cb72da790sm10015660a12.35.2024.06.20.12.16.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Jun 2024 12:16:37 -0700 (PDT) From: Ilias Apalodimas To: xypron.glpk@gmx.de Cc: Ilias Apalodimas , Tom Rini , Eddie James , Raymond Mao , Simon Glass , Masahisa Kojima , Tim Harvey , u-boot@lists.denx.de Subject: [PATCH 1/2] tpm: Fix return code, if the eventlog buffer is full Date: Thu, 20 Jun 2024 22:16:29 +0300 Message-ID: <20240620191631.28811-1-ilias.apalodimas@linaro.org> X-Mailer: git-send-email 2.45.2 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: 97707f12fdab ("tpm: Support boot measurements") Signed-off-by: Ilias Apalodimas --- 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