On Mon, May 18, 2026 at 08:47:22PM +0530, Arun Menon wrote:
> 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]>
> ---
>  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
> 


Reviewed-by: Jarkko Sakkinen <[email protected]>

BR, Jarkko

Reply via email to