From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BE24637883E for ; Mon, 18 May 2026 15:17:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779117474; cv=none; b=FMGqSmI+y5GOpacNprICfkUuiQ+M9YwzyxRyLlQ6QyHdwBDwlbFsdmI3eELjxotOuToDsxkbIZzfgDd13Rd5UK7FiGfaeJSSQjsrSFLWFNDltV5N/tr/OJR7YlY6+puWLg8C7uvGOJKZgfDbtIKSlsC6RlQfk2izTTzSPzhvBFI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779117474; c=relaxed/simple; bh=PRKgbwrbL5iMNslBxl3scRrf7sNesK+Vs+rfRBhB4R0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=hAQMyBk0PLolKZcMqhcAxfzbE7ILMfEvzjGiXCG3Glu0/kvV7f0UwAdV27Ab02pJcyf7NzLTB2hLK0A7iMWmRnS9GKQVQF/erysXOBRI0+vpQnyyzUYeqom/DWbVBRgQq/vRRR5n2LhgZq/QqiqbpVGk4rWetGeycjrHyRPu9H8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=ZMaX0Mbi; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b=d1wTpCzR; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="ZMaX0Mbi"; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b="d1wTpCzR" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1779117469; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=y1xmf5x73w7x9YqKPrcPljDvbvvQKElp2j9AELMu+d4=; b=ZMaX0Mbivziy8JDEPkDNug84ioe8Vwds+J2ErsUQQ1dYohYcRt8akJOjiXnpk8v6FTwR8J 1fpVY+y8nm8llo/09EHovJoGlz7M5Ey9HlglEwskv1dViO8aYSoac/tpKI3iU3DxdhXEC0 fK18KniEgnG8rkQxsVXLBo4pRRr0/Is= Received: from mail-pf1-f200.google.com (mail-pf1-f200.google.com [209.85.210.200]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-154-80ix7z3cPpG7BMTL1XPU9A-1; Mon, 18 May 2026 11:17:48 -0400 X-MC-Unique: 80ix7z3cPpG7BMTL1XPU9A-1 X-Mimecast-MFC-AGG-ID: 80ix7z3cPpG7BMTL1XPU9A_1779117467 Received: by mail-pf1-f200.google.com with SMTP id d2e1a72fcca58-82f6a5b4f88so4103647b3a.2 for ; Mon, 18 May 2026 08:17:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1779117467; x=1779722267; darn=vger.kernel.org; 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=y1xmf5x73w7x9YqKPrcPljDvbvvQKElp2j9AELMu+d4=; b=d1wTpCzRtfNOBj7XfRANCzMr78RNQDzBHreLV7JCoORJCUf2GUral2hvQtgxC/ZoOE 2QJMpf9I6DzVRrUPHF1t66KULBCnsndgre7+/mpl9J0ijYuRO1vOABK6GQldAxEizMJR xIeCTTPJhpcW3wltbrBnMfu8VPKzluCWeB3iHnz3se1yd6yXxTuXwaKPKjX4OfoU+/jd P0vrRZhGranGQJA2sCbmqMxqfVIdEKK2Vqb84bp56qbDgvaaY4o/4soij6oMzDYQM2h6 CPKkJpL/HLuDc9UFgOrzrA2ZMIBlyWeNb8FlDBd6QrYUVlwRIPu+9pz5Po+C61sisASe PBUw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1779117467; x=1779722267; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=y1xmf5x73w7x9YqKPrcPljDvbvvQKElp2j9AELMu+d4=; b=c0ecWIhBsCjrZW6bsVhMWjwdKefPMxZDir79XcGOBdaw2YaTpFhi7bw+OOIu/OCSoT fEH0d/o296+znouHl27b7AQySAM66dCwkiTZBQh79vr2yer0PBOPx2oj7ey/8o200Kp/ 2eDOxsVt1HShYq8FAg/zdpwS5p/lu47U1MZyxGpfxWxtfQP1vJ0NEhGEJ1rxcrDkh0T1 sigCVfhgTjNtZCHgiveK//obqetMc6ZYTbqhnz63UIZxxpG96V/nFvBDEgeWosgLbsT3 kq3VlqXU6Vjq8ebmhIRPbh14/mSmjVtHwxFai3P+VzaNVcQmBraYU0IFeHCI5I0yitqH FGvQ== X-Gm-Message-State: AOJu0Yz+e1hAKqWoScCikt6EZBqbR79aWj0TsAN+woVPHyf34vxV04FH eVVPwCDlZQ8hQGDZA7QoWwvZKq+CFVkoteLPO6N2tDw3InMD7qLOZPlvHkOPl4yBHYpT6Wug2AY egCAcKZKoZzizaQKGpK35Pc+/IlwYXzUHqgRuqMjkHwr4TVGACH0NjNtQ6dFOctkpTICuuvQJJR hGo61EKjUEcQLLEr2FyH5FYaFTwteqpm5j8/GQdZ/GeQsYfEYX X-Gm-Gg: Acq92OF/jCGhaWsoCy4mhTsFf+yecbUFBqA6Zv/JsGg6yFqY6CA64LqefUXw5NnFj+k mter8FnmG+4/XTdMbpnbtnmSbh9xGIkVM8XV8JngK/6vV+rBOi6H0XN0Sn4Re0Ujlc5mJ/DMcq8 RijzfaSNx6ayTGATtdJgDChBHXp2iq9Mzf6/mMqCjovos+D5YXWb7RZnbrgLBrNZT/NY+2L50ts 6eS/sv388A/NR5jkBaut7d+6DM6hUpFafNSQsYw29uJPxs53/QZ0KhyAu/Zp5jCX9GeUsj0zWZN oO+yhZe80BFCarVKnAFidcPMO0mWRYSrqm3a83paL1tImOh4XbmzG4jg+/IcrSrpZGmrnnn1Uog yfTqx5KF+nsRupJQksxYAp+06bnmapzdJ6V9GbYsA9KS0zdHhEwa3Laja0z3EG3c= X-Received: by 2002:a05:6a00:1743:b0:82f:3828:a009 with SMTP id d2e1a72fcca58-83f33aebda2mr16553748b3a.3.1779117467417; Mon, 18 May 2026 08:17:47 -0700 (PDT) X-Received: by 2002:a05:6a00:1743:b0:82f:3828:a009 with SMTP id d2e1a72fcca58-83f33aebda2mr16553698b3a.3.1779117466798; Mon, 18 May 2026 08:17:46 -0700 (PDT) Received: from fedora.armenon-thinkpadp16vgen1.bengluru.csb ([49.36.104.172]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-83f197815cesm18181153b3a.24.2026.05.18.08.17.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 May 2026 08:17:46 -0700 (PDT) From: Arun Menon To: linux-kernel@vger.kernel.org Cc: Jarkko Sakkinen , linux-integrity@vger.kernel.org, Jason Gunthorpe , Peter Huewe , Arun Menon Subject: [PATCH v3 4/6] tpm: tis_i2c: Use local 4KB buffer to limit memory usage Date: Mon, 18 May 2026 20:47:22 +0530 Message-ID: <20260518151724.730443-5-armenon@redhat.com> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260518151724.730443-1-armenon@redhat.com> References: <20260518151724.730443-1-armenon@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Arun Menon The global increase of TPM_BUFSIZE to 8KB is necessary to support Post-Quantum Cryptography (PQC) payloads. However, applying this increase to the tpm_tis_i2c driver is unnecessary and wasteful due to physical transport limitations as pointed out in [1] This commit introduces a local buffer limit that is used in the i2c driver. [1] https://sashiko.dev/#/patchset/20260324071803.324774-1-armenon%40redhat.com?patch=8319 Signed-off-by: Arun Menon --- drivers/char/tpm/tpm_tis_i2c.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/char/tpm/tpm_tis_i2c.c b/drivers/char/tpm/tpm_tis_i2c.c index 6cd07dd34507..db19d459ea1e 100644 --- a/drivers/char/tpm/tpm_tis_i2c.c +++ b/drivers/char/tpm/tpm_tis_i2c.c @@ -54,6 +54,8 @@ #define TPM_INTF_CAPABILITY_ZERO 0x0FFFF000 #define TPM_I2C_INTERFACE_CAPABILITY_ZERO 0x80000000 +#define TPM_I2C_BUFSIZE 4096 + struct tpm_tis_i2c_phy { struct tpm_tis_data priv; struct i2c_client *i2c_client; @@ -232,7 +234,7 @@ static int tpm_tis_i2c_write_bytes(struct tpm_tis_data *data, u32 addr, u16 len, int ret; u16 wrote = 0; - if (len > TPM_BUFSIZE - 1) + if (len > TPM_I2C_BUFSIZE - 1) return -EIO; phy->io_buf[0] = reg; @@ -339,7 +341,7 @@ static int tpm_tis_i2c_probe(struct i2c_client *dev) if (!phy) return -ENOMEM; - phy->io_buf = devm_kzalloc(&dev->dev, TPM_BUFSIZE, GFP_KERNEL); + phy->io_buf = devm_kzalloc(&dev->dev, TPM_I2C_BUFSIZE, GFP_KERNEL); if (!phy->io_buf) return -ENOMEM; -- 2.54.0