From: Arun Menon <[email protected]> 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 <[email protected]> Reviewed-by: Jarkko Sakkinen <[email protected]> --- 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 cde0b093ed58..4667eef15ff1 100644 --- a/drivers/char/tpm/tpm_tis_i2c.c +++ b/drivers/char/tpm/tpm_tis_i2c.c @@ -55,6 +55,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; @@ -233,7 +235,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; @@ -341,7 +343,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.56.0
