[PATCH v10 1/4] tpm: Make TPM buffer allocations more robust

kernel test robot lkp at intel.com
Sun Sep 21 08:53:39 UTC 2025


Hi Jarkko,

kernel test robot noticed the following build warnings:

[auto build test WARNING on next-20250919]
[cannot apply to char-misc/char-misc-testing char-misc/char-misc-next char-misc/char-misc-linus linus/master v6.17-rc6 v6.17-rc5 v6.17-rc4 v6.17-rc6]
[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/Jarkko-Sakkinen/tpm-Make-TPM-buffer-allocations-more-robust/20250921-102024
base:   next-20250919
patch link:    https://lore.kernel.org/r/20250921020804.1088824-2-jarkko%40kernel.org
patch subject: [PATCH v10 1/4] tpm: Make TPM buffer allocations more robust
config: x86_64-buildonly-randconfig-001-20250921 (https://download.01.org/0day-ci/archive/20250921/202509211636.ZaHdTpHP-lkp@intel.com/config)
compiler: clang version 20.1.8 (https://github.com/llvm/llvm-project 87f0227cb60147a26a1eeb4fb06e3b505e9c7261)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250921/202509211636.ZaHdTpHP-lkp@intel.com/reproduce)

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 at intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202509211636.ZaHdTpHP-lkp@intel.com/

All warnings (new ones prefixed by >>):

>> drivers/char/tpm/tpm-buf.c:20:9: warning: format specifies type 'unsigned int' but the argument has type 'unsigned long' [-Wformat]
      19 |                         WARN(1, "%s: size mismatch: %u != %u\n", __func__, buf_size,
         |                                                           ~~
         |                                                           %lu
      20 |                              buf->capacity + sizeof(*buf));
         |                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/asm-generic/bug.h:141:29: note: expanded from macro 'WARN'
     141 |                 __WARN_printf(TAINT_WARN, format);                      \
         |                                           ^~~~~~
   include/asm-generic/bug.h:112:17: note: expanded from macro '__WARN_printf'
     112 |                 __warn_printk(arg);                                     \
         |                               ^~~
   1 warning generated.


vim +20 drivers/char/tpm/tpm-buf.c

     9	
    10	static void __tpm_buf_size_invariant(struct tpm_buf *buf, u16 buf_size)
    11	{
    12		if (!buf->capacity) {
    13			if (buf_size > TPM_BUF_MAX_SIZE) {
    14				WARN(1, "%s: size overflow: %u\n", __func__, buf_size);
    15				buf->flags |= TPM_BUF_ERROR;
    16			}
    17		} else {
    18			if (buf_size != buf->capacity + sizeof(*buf)) {
    19				WARN(1, "%s: size mismatch: %u != %u\n", __func__, buf_size,
  > 20				     buf->capacity + sizeof(*buf));
    21				buf->flags |= TPM_BUF_ERROR;
    22			}
    23		}
    24	}
    25	

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



More information about the Linux-security-module-archive mailing list