All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Stuart Yoder <stuart.yoder@arm.com>
Cc: oe-kbuild-all@lists.linux.dev, linux-kernel@vger.kernel.org,
	Jarkko Sakkinen <jarkko@kernel.org>
Subject: drivers/char/tpm/tpm_crb_ffa.c:311 tpm_crb_ffa_probe() warn: unsigned 'tpm_crb_ffa->minor_version' is never less than zero.
Date: Fri, 19 Dec 2025 00:54:57 +0800	[thread overview]
Message-ID: <202512190044.RICLFTSA-lkp@intel.com> (raw)

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

                 reply	other threads:[~2025-12-18 16:55 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=202512190044.RICLFTSA-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=jarkko@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=oe-kbuild-all@lists.linux.dev \
    --cc=stuart.yoder@arm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.