From patchwork Sat Jun 22 14:35:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilias Apalodimas X-Patchwork-Id: 806721 Delivered-To: patch@linaro.org Received: by 2002:a5d:508d:0:b0:362:4979:7f74 with SMTP id a13csp1200934wrt; Sat, 22 Jun 2024 07:36:38 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXDmAylit9pZ3BCylWFethUU3tKYyxnzH+8zASDY71y/TA+ZSS7XJIKNPT1q6ZtKko+dGHoAPH0hOBGDspyT7mb X-Google-Smtp-Source: AGHT+IHKLSXBPMNOrGO0+BNyz8um+aMLwO2Mq84ncZjURM/HXH9J+E+1Y/7Ist/DEPBqQn16oEa8 X-Received: by 2002:a17:907:c20e:b0:a6f:68b6:4e7a with SMTP id a640c23a62f3a-a7242c9beb5mr37412766b.19.1719066998700; Sat, 22 Jun 2024 07:36:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1719066998; cv=none; d=google.com; s=arc-20160816; b=gq8CTFXzfO6waVAmlw/TboIk/kgYkQ4qOsI2S8LsTHHRjRHW2UiaFqQlOvhFzNZtIA H290RxWE8SU8DK7RkLfmLNcg6WyjQYXAnnM+tA2ITxEepUiKqdD5fEx4VVs6DHS6nXqT 0mTed+3t0u2S+OnLno/nDrTDxSDNiN71LTUL3fpmhd5Bz9KTs676cb5g/axryCmPRTu5 koPhq4uWFn2CjRRy1UGB/4Tcz566myMxHZRj6RYh5+BlWREBosqw1enyDivipW50tm/a i+8BVrXAjselyG5wqBnQPmsvvNNKwkub/ZNZ9h/bdH15RJzFBhcgqGfUS9afc8yiJyai 9hgQ== 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=2N8RNRcSBLmt0ZSK5CiACSpazEEoUvaXOylAXemtb1s=; fh=PnlrZ+izBUKIkDKFazcblh0ZNg6kR4KN0mBn4E8xSBc=; b=HKN9LQ64XEtLv2w4paxxMVXIiy5gZGX20jmnjE9AeJuwWbNZDB3t2ywZVOX+6R+4lH uG9NY8QIDNWK8WUAA3jawzupiNp3dONg6KA/PbUht/UTHd41Dai9dLjAnUV3JZcveLLb q0MIqR8DAjN+cR5dp0sZxbngdRhMPRoi6/Owh3bidRk6y/ojq8+JbpxsCR45Or1vRFz3 Rozrg0HGOyX0LE6u99+6G6tjph818oR+7EJ67RZjyUto0+OoDsAdS+vR2RcelkwcGIRy hpcgL+p7z76kmhMDL2U6jdz24GiEoRBQEExAIh0Tdo5lmOOB1KscNn9mgHayCWClZAfS vnZA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=R+y8tdiE; 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-a6fcf5ad41bsi187350666b.968.2024.06.22.07.36.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 22 Jun 2024 07:36:38 -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=R+y8tdiE; 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 623D888001; Sat, 22 Jun 2024 16:36:28 +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="R+y8tdiE"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 231ED87FB5; Sat, 22 Jun 2024 16:36:27 +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-ej1-x636.google.com (mail-ej1-x636.google.com [IPv6:2a00:1450:4864:20::636]) (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 3B62F87D8E for ; Sat, 22 Jun 2024 16:36:25 +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-x636.google.com with SMTP id a640c23a62f3a-a6265d3ba8fso309797466b.0 for ; Sat, 22 Jun 2024 07:36:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1719066985; x=1719671785; 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=2N8RNRcSBLmt0ZSK5CiACSpazEEoUvaXOylAXemtb1s=; b=R+y8tdiEptRjeRld33GnAlLW8a2VTVvvQw7iLhvVZStDHUulu36ZmPJ9D5+scty5cS 3aClAF8yitrIM9U84QMzQH6mg0cQ56KI3hUWB0aZONSA46BpcacKk2xhfoWL0y6Oym9o ct62mrogkEad5NbB6VQA+rRjMZW07lccpsn4zUyPRtGTi8ogf5bJcQg/G6s6MhL7gH4R +hsfdAnFGSHBHhvqlcguhdmXUTtBKpyPqFw01cIxay8RKdiL5T5IZJw74/VElMEKbrJe uTUTaRY+9sT/lJzV3wm2xXD33BhOQApu3fDsw1mpugu53NQSllbYJurmzX38+c/xy72f aLKA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719066985; x=1719671785; 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=2N8RNRcSBLmt0ZSK5CiACSpazEEoUvaXOylAXemtb1s=; b=mmbFmnSqHiRXKqRonRFIFbaY9+C0PHzbLazt/wiknYBU7I5SyQX0fvPhzRwu26mnbm M51Ii+6NmRTlBr840WcpYgDTXyAOP5nukyRogBTPadLlfqNhmQKgCcXcxdOb3AdbBPqC IOfvcNKBx0NEKJQG7C+mcf4lxrNQhT+Jm/y9ddQhGrPucqmX1RvkkvbAtJYqczP3loYA AntUXYq/HB6cQX34z60HuPoXCD8uxZpVa+hXekCBw9Id8Z15sAQAwVcQcB71P5VybyqS Vq7AftsO3SaMw8R0MAVvADcDZ5wgOrxKrIZtGE1FSseWkSJrMctwbHixifn71CPFitxj L7iw== X-Forwarded-Encrypted: i=1; AJvYcCW+PR6wdAUYXDwAtztxUNL8DjKm1jptn3xplRgJ8dYoWlJF8gCflASbsixS9Su2av+ELRkYS/y77JNNGM9huSMnhDg5og== X-Gm-Message-State: AOJu0Yz97uXIg58uzh5ESC09Q/w0Uwszrd6L/bKrwQNjBv4aPwxJyXI/ hYh8iGYiWsE7MrcphtnCFv0e59ZbI5WSYleOEsndF6rITKbjxNDcz9UjNSv4IUU= X-Received: by 2002:a17:907:c307:b0:a6f:2981:56c with SMTP id a640c23a62f3a-a7242da6a35mr29659866b.53.1719066984464; Sat, 22 Jun 2024 07:36:24 -0700 (PDT) Received: from localhost.localdomain (ppp046103020130.access.hol.gr. [46.103.20.130]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a6fcf54a534sm204005366b.136.2024.06.22.07.36.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 22 Jun 2024 07:36:23 -0700 (PDT) From: Ilias Apalodimas To: sjg@chromium.org, trini@konsulko.com Cc: Ilias Apalodimas , Heinrich Schuchardt , 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 1/7] tpm: fix the return code, if the eventlog buffer is full Date: Sat, 22 Jun 2024 17:35:37 +0300 Message-ID: <20240622143601.187723-2-ilias.apalodimas@linaro.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240622143601.187723-1-ilias.apalodimas@linaro.org> References: <20240622143601.187723-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") Signed-off-by: Ilias Apalodimas Reviewed-by: Heinrich Schuchardt --- 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