mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* drivers/char/tpm/tpm_crb_ffa.c:311 tpm_crb_ffa_probe() warn: unsigned 'tpm_crb_ffa->minor_version' is never less than zero.
@ 2025-12-18 16:54 kernel test robot
  0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2025-12-18 16:54 UTC (permalink / raw)
  To: Stuart Yoder; +Cc: oe-kbuild-all, linux-kernel, Jarkko Sakkinen

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   ea1013c1539270e372fc99854bc6e4d94eaeff66
commit: eb93f0734ef1bc5657313bfb55cda58763363603 tpm_crb: ffa_tpm: Implement driver compliant to CRB over FF-A
date:   9 months ago
config: arm64-randconfig-r072-20251218 (https://download.01.org/0day-ci/archive/20251219/202512190044.RICLFTSA-lkp@intel.com/config)
compiler: aarch64-linux-gcc (GCC) 9.5.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>
| Closes: https://lore.kernel.org/oe-kbuild-all/202512190044.RICLFTSA-lkp@intel.com/

smatch warnings:
drivers/char/tpm/tpm_crb_ffa.c:311 tpm_crb_ffa_probe() warn: unsigned 'tpm_crb_ffa->minor_version' is never less than zero.

vim +311 drivers/char/tpm/tpm_crb_ffa.c

   268	
   269	static int tpm_crb_ffa_probe(struct ffa_device *ffa_dev)
   270	{
   271		struct tpm_crb_ffa *p;
   272		int rc;
   273	
   274		/* only one instance of a TPM partition is supported */
   275		if (tpm_crb_ffa && !IS_ERR_VALUE(tpm_crb_ffa))
   276			return -EEXIST;
   277	
   278		tpm_crb_ffa = ERR_PTR(-ENODEV); // set tpm_crb_ffa so we can detect probe failure
   279	
   280		if (!ffa_partition_supports_direct_recv(ffa_dev)) {
   281			pr_err("TPM partition doesn't support direct message receive.\n");
   282			return -EINVAL;
   283		}
   284	
   285		p = kzalloc(sizeof(*tpm_crb_ffa), GFP_KERNEL);
   286		if (!p)
   287			return -ENOMEM;
   288		tpm_crb_ffa = p;
   289	
   290		mutex_init(&tpm_crb_ffa->msg_data_lock);
   291		tpm_crb_ffa->ffa_dev = ffa_dev;
   292		ffa_dev_set_drvdata(ffa_dev, tpm_crb_ffa);
   293	
   294		/* if TPM is aarch32 use 32-bit SMCs */
   295		if (!ffa_partition_check_property(ffa_dev, FFA_PARTITION_AARCH64_EXEC))
   296			ffa_dev->ops->msg_ops->mode_32bit_set(ffa_dev);
   297	
   298		/* verify compatibility of TPM service version number */
   299		rc = tpm_crb_ffa_get_interface_version(&tpm_crb_ffa->major_version,
   300						       &tpm_crb_ffa->minor_version);
   301		if (rc) {
   302			pr_err("failed to get crb interface version. rc:%d", rc);
   303			goto out;
   304		}
   305	
   306		pr_info("ABI version %u.%u", tpm_crb_ffa->major_version,
   307			tpm_crb_ffa->minor_version);
   308	
   309		if (tpm_crb_ffa->major_version != CRB_FFA_VERSION_MAJOR ||
   310		    (tpm_crb_ffa->minor_version > 0 &&
 > 311		    tpm_crb_ffa->minor_version < CRB_FFA_VERSION_MINOR)) {
   312			pr_err("Incompatible ABI version");
   313			goto out;
   314		}
   315	
   316		return 0;
   317	
   318	out:
   319		kfree(tpm_crb_ffa);
   320		tpm_crb_ffa = ERR_PTR(-ENODEV);
   321		return -EINVAL;
   322	}
   323	

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2025-12-18 16:55 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-12-18 16:54 drivers/char/tpm/tpm_crb_ffa.c:311 tpm_crb_ffa_probe() warn: unsigned 'tpm_crb_ffa->minor_version' is never less than zero kernel test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®