All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC 4/4] tpm: Increase TPM_BUFSIZE to 64kB for chunking support
  2026-03-24  7:17 [RFC 0/4] tpm_crb: Add command and response buffer " Arun Menon
@ 2026-03-24  7:18 ` Arun Menon
  0 siblings, 0 replies; 2+ messages in thread
From: Arun Menon @ 2026-03-24  7:18 UTC (permalink / raw)
  To: linux-kernel
  Cc: linux-integrity, Jason Gunthorpe, Jarkko Sakkinen, Peter Huewe,
	Arun Menon

- In tpm_common_write() the size of the command is checked against
  TPM_BUFSIZE. We therefore need to increase the TPM_BUFSIZE to allow
  support for larger commands.

Signed-off-by: Arun Menon <armenon@redhat.com>
---
 drivers/char/tpm/tpm.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/char/tpm/tpm.h b/drivers/char/tpm/tpm.h
index 87d68ddf270a7..a6933eb075296 100644
--- a/drivers/char/tpm/tpm.h
+++ b/drivers/char/tpm/tpm.h
@@ -33,7 +33,7 @@
 #endif
 
 #define TPM_MINOR		224	/* officially assigned */
-#define TPM_BUFSIZE		4096
+#define TPM_BUFSIZE		65536
 #define TPM_NUM_DEVICES		65536
 #define TPM_RETRY		50
 
-- 
2.53.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [RFC 4/4] tpm: Increase TPM_BUFSIZE to 64kB for chunking support
@ 2026-03-28  0:35 kernel test robot
  0 siblings, 0 replies; 2+ messages in thread
From: kernel test robot @ 2026-03-28  0:35 UTC (permalink / raw)
  To: oe-kbuild; +Cc: lkp, Dan Carpenter

BCC: lkp@intel.com
CC: oe-kbuild-all@lists.linux.dev
In-Reply-To: <20260324071803.324774-5-armenon@redhat.com>
References: <20260324071803.324774-5-armenon@redhat.com>
TO: Arun Menon <armenon@redhat.com>

Hi Arun,

[This is a private test report for your RFC patch.]
kernel test robot noticed the following build warnings:

[auto build test WARNING on char-misc/char-misc-testing]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Arun-Menon/tpm_crb-Add-definition-of-TPM-CRB-chunking-fields/20260326-015436
base:   char-misc/char-misc-testing
patch link:    https://lore.kernel.org/r/20260324071803.324774-5-armenon%40redhat.com
patch subject: [RFC 4/4] tpm: Increase TPM_BUFSIZE to 64kB for chunking support
:::::: branch date: 2 days ago
:::::: commit date: 2 days ago
config: openrisc-randconfig-r072-20260328 (https://download.01.org/0day-ci/archive/20260328/202603280809.fCfcehTj-lkp@intel.com/config)
compiler: or1k-linux-gcc (GCC) 12.5.0
smatch: v0.5.0-9004-gb810ac53

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Reported-by: Dan Carpenter <error27@gmail.com>
| Closes: https://lore.kernel.org/r/202603280809.fCfcehTj-lkp@intel.com/

smatch warnings:
drivers/char/tpm/tpm_tis_i2c.c:235 tpm_tis_i2c_write_bytes() warn: impossible condition '(len > 65536 - 1) => (0-u16max > u16max)'

vim +235 drivers/char/tpm/tpm_tis_i2c.c

bbc23a07b0728c Alexander Steffen  2022-06-08  224  
bbc23a07b0728c Alexander Steffen  2022-06-08  225  static int tpm_tis_i2c_write_bytes(struct tpm_tis_data *data, u32 addr, u16 len,
bbc23a07b0728c Alexander Steffen  2022-06-08  226  				   const u8 *value,
bbc23a07b0728c Alexander Steffen  2022-06-08  227  				   enum tpm_tis_io_mode io_mode)
bbc23a07b0728c Alexander Steffen  2022-06-08  228  {
bbc23a07b0728c Alexander Steffen  2022-06-08  229  	struct tpm_tis_i2c_phy *phy = to_tpm_tis_i2c_phy(data);
bbc23a07b0728c Alexander Steffen  2022-06-08  230  	struct i2c_msg msg = { .addr = phy->i2c_client->addr };
bbc23a07b0728c Alexander Steffen  2022-06-08  231  	u8 reg = tpm_tis_i2c_address_to_register(addr);
bbc23a07b0728c Alexander Steffen  2022-06-08  232  	int ret;
83e7e5d89f04d1 Alexander Sverdlin 2023-05-24  233  	u16 wrote = 0;
bbc23a07b0728c Alexander Steffen  2022-06-08  234  
bbc23a07b0728c Alexander Steffen  2022-06-08 @235  	if (len > TPM_BUFSIZE - 1)
bbc23a07b0728c Alexander Steffen  2022-06-08  236  		return -EIO;
bbc23a07b0728c Alexander Steffen  2022-06-08  237  
bbc23a07b0728c Alexander Steffen  2022-06-08  238  	phy->io_buf[0] = reg;
bbc23a07b0728c Alexander Steffen  2022-06-08  239  	msg.buf = phy->io_buf;
83e7e5d89f04d1 Alexander Sverdlin 2023-05-24  240  	while (wrote < len) {
83e7e5d89f04d1 Alexander Sverdlin 2023-05-24  241  		/* write register and data in one go */
83e7e5d89f04d1 Alexander Sverdlin 2023-05-24  242  		msg.len = sizeof(reg) + len - wrote;
83e7e5d89f04d1 Alexander Sverdlin 2023-05-24  243  		if (msg.len > I2C_SMBUS_BLOCK_MAX)
83e7e5d89f04d1 Alexander Sverdlin 2023-05-24  244  			msg.len = I2C_SMBUS_BLOCK_MAX;
83e7e5d89f04d1 Alexander Sverdlin 2023-05-24  245  
83e7e5d89f04d1 Alexander Sverdlin 2023-05-24  246  		memcpy(phy->io_buf + sizeof(reg), value + wrote,
83e7e5d89f04d1 Alexander Sverdlin 2023-05-24  247  		       msg.len - sizeof(reg));
83e7e5d89f04d1 Alexander Sverdlin 2023-05-24  248  
bbc23a07b0728c Alexander Steffen  2022-06-08  249  		ret = tpm_tis_i2c_retry_transfer_until_ack(data, &msg);
bbc23a07b0728c Alexander Steffen  2022-06-08  250  		if (ret < 0)
bbc23a07b0728c Alexander Steffen  2022-06-08  251  			return ret;
83e7e5d89f04d1 Alexander Sverdlin 2023-05-24  252  		wrote += msg.len - sizeof(reg);
83e7e5d89f04d1 Alexander Sverdlin 2023-05-24  253  	}
bbc23a07b0728c Alexander Steffen  2022-06-08  254  
bbc23a07b0728c Alexander Steffen  2022-06-08  255  	return 0;
bbc23a07b0728c Alexander Steffen  2022-06-08  256  }
bbc23a07b0728c Alexander Steffen  2022-06-08  257  

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-03-28  0:36 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-28  0:35 [RFC 4/4] tpm: Increase TPM_BUFSIZE to 64kB for chunking support kernel test robot
  -- strict thread matches above, loose matches on Subject: below --
2026-03-24  7:17 [RFC 0/4] tpm_crb: Add command and response buffer " Arun Menon
2026-03-24  7:18 ` [RFC 4/4] tpm: Increase TPM_BUFSIZE to 64kB for " Arun Menon

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.