All of lore.kernel.org
 help / color / mirror / Atom feed
* [linux-next:master 7959/8263] drivers/char/tpm/tpm_ppi.c:349 tpm_show_ppi_tcg_operations() warn: inconsistent returns 'global &tpm_ppi_lock'.
@ 2025-09-11 18:56 ` Dan Carpenter
  0 siblings, 0 replies; 4+ messages in thread
From: kernel test robot @ 2025-09-11 18:31 UTC (permalink / raw)
  To: oe-kbuild; +Cc: lkp, Dan Carpenter

BCC: lkp@intel.com
CC: oe-kbuild-all@lists.linux.dev
TO: Denis Aleksandrov <daleksan@redhat.com>
CC: Jarkko Sakkinen <jarkko@kernel.org>
CC: Paul Menzel <pmenzel@molgen.mpg.de>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head:   8f21d9da46702c4d6951ba60ca8a05f42870fe8f
commit: 18aada46edf7f79dba1ab89a100d0fc350d4a5c8 [7959/8263] tpm: Prevent local DOS via tpm/tpm0/ppi/*operations
:::::: branch date: 12 hours ago
:::::: commit date: 21 hours ago
config: x86_64-randconfig-161-20250911 (https://download.01.org/0day-ci/archive/20250912/202509120229.YpG1CcD3-lkp@intel.com/config)
compiler: gcc-14 (Debian 14.2.0-19) 14.2.0

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/202509120229.YpG1CcD3-lkp@intel.com/

smatch warnings:
drivers/char/tpm/tpm_ppi.c:349 tpm_show_ppi_tcg_operations() warn: inconsistent returns 'global &tpm_ppi_lock'.
drivers/char/tpm/tpm_ppi.c:378 tpm_show_ppi_vs_operations() warn: inconsistent returns 'global &tpm_ppi_lock'.

vim +349 drivers/char/tpm/tpm_ppi.c

f84fdff0fdcda7 Xiaoyan Zhang     2012-08-22  322  
81198078d7da42 Xiaoyan Zhang     2013-08-29  323  static ssize_t tpm_show_ppi_tcg_operations(struct device *dev,
81198078d7da42 Xiaoyan Zhang     2013-08-29  324  					   struct device_attribute *attr,
81198078d7da42 Xiaoyan Zhang     2013-08-29  325  					   char *buf)
f84fdff0fdcda7 Xiaoyan Zhang     2012-08-22  326  {
9b774d5cf2db4b Jarkko Sakkinen   2015-04-14  327  	struct tpm_chip *chip = to_tpm_chip(dev);
18aada46edf7f7 Denis Aleksandrov 2025-09-10  328  	ssize_t len = 0;
18aada46edf7f7 Denis Aleksandrov 2025-09-10  329  	u32 ret;
18aada46edf7f7 Denis Aleksandrov 2025-09-10  330  	int i;
0dc553652102c5 Jarkko Sakkinen   2014-12-12  331  
18aada46edf7f7 Denis Aleksandrov 2025-09-10  332  	spin_lock(&tpm_ppi_lock);
18aada46edf7f7 Denis Aleksandrov 2025-09-10  333  	if (!ppi_cache_populated) {
18aada46edf7f7 Denis Aleksandrov 2025-09-10  334  		len = cache_ppi_operations(chip->acpi_dev_handle, buf);
18aada46edf7f7 Denis Aleksandrov 2025-09-10  335  		if (len < 0)
18aada46edf7f7 Denis Aleksandrov 2025-09-10  336  			return len;
18aada46edf7f7 Denis Aleksandrov 2025-09-10  337  
18aada46edf7f7 Denis Aleksandrov 2025-09-10  338  		ppi_cache_populated = true;
18aada46edf7f7 Denis Aleksandrov 2025-09-10  339  	}
18aada46edf7f7 Denis Aleksandrov 2025-09-10  340  
18aada46edf7f7 Denis Aleksandrov 2025-09-10  341  	for (i = 0; i <= PPI_TPM_REQ_MAX; i++) {
18aada46edf7f7 Denis Aleksandrov 2025-09-10  342  		ret = ppi_operations_cache[i];
18aada46edf7f7 Denis Aleksandrov 2025-09-10  343  		if (ret >= 0 && ret < ARRAY_SIZE(tpm_ppi_info))
18aada46edf7f7 Denis Aleksandrov 2025-09-10  344  			len += sysfs_emit_at(buf, len, "%d %d: %s\n",
18aada46edf7f7 Denis Aleksandrov 2025-09-10  345  							i, ret, tpm_ppi_info[ret]);
18aada46edf7f7 Denis Aleksandrov 2025-09-10  346  	}
18aada46edf7f7 Denis Aleksandrov 2025-09-10  347  	spin_unlock(&tpm_ppi_lock);
18aada46edf7f7 Denis Aleksandrov 2025-09-10  348  
18aada46edf7f7 Denis Aleksandrov 2025-09-10 @349  	return len;
f84fdff0fdcda7 Xiaoyan Zhang     2012-08-22  350  }
f84fdff0fdcda7 Xiaoyan Zhang     2012-08-22  351  
81198078d7da42 Xiaoyan Zhang     2013-08-29  352  static ssize_t tpm_show_ppi_vs_operations(struct device *dev,
81198078d7da42 Xiaoyan Zhang     2013-08-29  353  					  struct device_attribute *attr,
81198078d7da42 Xiaoyan Zhang     2013-08-29  354  					  char *buf)
f84fdff0fdcda7 Xiaoyan Zhang     2012-08-22  355  {
9b774d5cf2db4b Jarkko Sakkinen   2015-04-14  356  	struct tpm_chip *chip = to_tpm_chip(dev);
18aada46edf7f7 Denis Aleksandrov 2025-09-10  357  	ssize_t len = 0;
18aada46edf7f7 Denis Aleksandrov 2025-09-10  358  	u32 ret;
18aada46edf7f7 Denis Aleksandrov 2025-09-10  359  	int i;
18aada46edf7f7 Denis Aleksandrov 2025-09-10  360  
18aada46edf7f7 Denis Aleksandrov 2025-09-10  361  	spin_lock(&tpm_ppi_lock);
18aada46edf7f7 Denis Aleksandrov 2025-09-10  362  	if (!ppi_cache_populated) {
18aada46edf7f7 Denis Aleksandrov 2025-09-10  363  		len = cache_ppi_operations(chip->acpi_dev_handle, buf);
18aada46edf7f7 Denis Aleksandrov 2025-09-10  364  		if (len < 0)
18aada46edf7f7 Denis Aleksandrov 2025-09-10  365  			return len;
18aada46edf7f7 Denis Aleksandrov 2025-09-10  366  
18aada46edf7f7 Denis Aleksandrov 2025-09-10  367  		ppi_cache_populated = true;
18aada46edf7f7 Denis Aleksandrov 2025-09-10  368  	}
0dc553652102c5 Jarkko Sakkinen   2014-12-12  369  
18aada46edf7f7 Denis Aleksandrov 2025-09-10  370  	for (i = PPI_VS_REQ_START; i <= PPI_VS_REQ_END; i++) {
18aada46edf7f7 Denis Aleksandrov 2025-09-10  371  		ret = ppi_operations_cache[i];
18aada46edf7f7 Denis Aleksandrov 2025-09-10  372  		if (ret >= 0 && ret < ARRAY_SIZE(tpm_ppi_info))
18aada46edf7f7 Denis Aleksandrov 2025-09-10  373  			len += sysfs_emit_at(buf, len, "%d %d: %s\n",
18aada46edf7f7 Denis Aleksandrov 2025-09-10  374  							i, ret, tpm_ppi_info[ret]);
18aada46edf7f7 Denis Aleksandrov 2025-09-10  375  	}
18aada46edf7f7 Denis Aleksandrov 2025-09-10  376  	spin_unlock(&tpm_ppi_lock);
18aada46edf7f7 Denis Aleksandrov 2025-09-10  377  
18aada46edf7f7 Denis Aleksandrov 2025-09-10 @378  	return len;
f84fdff0fdcda7 Xiaoyan Zhang     2012-08-22  379  }
f84fdff0fdcda7 Xiaoyan Zhang     2012-08-22  380  

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

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

end of thread, other threads:[~2025-09-14 17:11 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-09-11 18:31 [linux-next:master 7959/8263] drivers/char/tpm/tpm_ppi.c:349 tpm_show_ppi_tcg_operations() warn: inconsistent returns 'global &tpm_ppi_lock' kernel test robot
2025-09-11 18:56 ` Dan Carpenter
2025-09-11 19:21 ` Denis Aleksandrov
2025-09-14 17:11   ` Jarkko Sakkinen

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.