All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: oe-kbuild@lists.linux.dev
Cc: lkp@intel.com, Dan Carpenter <error27@gmail.com>
Subject: Re: [PATCH v5] tpm: Managed allocations for tpm_buf instances
Date: Sun, 6 Jul 2025 21:56:17 +0800	[thread overview]
Message-ID: <202507062112.JKYfCa34-lkp@intel.com> (raw)

BCC: lkp@intel.com
CC: oe-kbuild-all@lists.linux.dev
In-Reply-To: <20250703181712.923302-1-jarkko@kernel.org>
References: <20250703181712.923302-1-jarkko@kernel.org>
TO: Jarkko Sakkinen <jarkko@kernel.org>

Hi Jarkko,

kernel test robot noticed the following build warnings:

[auto build test WARNING on char-misc/char-misc-testing]
[also build test WARNING on char-misc/char-misc-next char-misc/char-misc-linus linus/master v6.16-rc4 next-20250704]
[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-Managed-allocations-for-tpm_buf-instances/20250704-021800
base:   char-misc/char-misc-testing
patch link:    https://lore.kernel.org/r/20250703181712.923302-1-jarkko%40kernel.org
patch subject: [PATCH v5] tpm: Managed allocations for tpm_buf instances
:::::: branch date: 3 days ago
:::::: commit date: 3 days ago
config: i386-randconfig-141-20250704 (https://download.01.org/0day-ci/archive/20250706/202507062112.JKYfCa34-lkp@intel.com/config)
compiler: gcc-12 (Debian 12.2.0-14+deb12u1) 12.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/202507062112.JKYfCa34-lkp@intel.com/

smatch warnings:
drivers/char/tpm/tpm2-cmd.c:211 tpm2_pcr_read() warn: missing error code? 'rc'

vim +/rc +211 drivers/char/tpm/tpm2-cmd.c

91f7f3d773a469 Roberto Sassu   2017-06-23  155  
7a1d7e6dd76a20 Jarkko Sakkinen 2014-12-12  156  /**
7a1d7e6dd76a20 Jarkko Sakkinen 2014-12-12  157   * tpm2_pcr_read() - read a PCR value
7a1d7e6dd76a20 Jarkko Sakkinen 2014-12-12  158   * @chip:	TPM chip to use.
7a1d7e6dd76a20 Jarkko Sakkinen 2014-12-12  159   * @pcr_idx:	index of the PCR to read.
879b589210a9a0 Roberto Sassu   2019-02-06  160   * @digest:	PCR bank and buffer current PCR value is written to.
879b589210a9a0 Roberto Sassu   2019-02-06  161   * @digest_size_ptr:	pointer to variable that stores the digest size.
7a1d7e6dd76a20 Jarkko Sakkinen 2014-12-12  162   *
794c6e109b5938 Winkler, Tomas  2016-11-23  163   * Return: Same as with tpm_transmit_cmd.
7a1d7e6dd76a20 Jarkko Sakkinen 2014-12-12  164   */
879b589210a9a0 Roberto Sassu   2019-02-06  165  int tpm2_pcr_read(struct tpm_chip *chip, u32 pcr_idx,
879b589210a9a0 Roberto Sassu   2019-02-06  166  		  struct tpm_digest *digest, u16 *digest_size_ptr)
7a1d7e6dd76a20 Jarkko Sakkinen 2014-12-12  167  {
879b589210a9a0 Roberto Sassu   2019-02-06  168  	int i;
7a1d7e6dd76a20 Jarkko Sakkinen 2014-12-12  169  	int rc;
91f7f3d773a469 Roberto Sassu   2017-06-23  170  	struct tpm2_pcr_read_out *out;
91f7f3d773a469 Roberto Sassu   2017-06-23  171  	u8 pcr_select[TPM2_PCR_SELECT_MIN] = {0};
879b589210a9a0 Roberto Sassu   2019-02-06  172  	u16 digest_size;
879b589210a9a0 Roberto Sassu   2019-02-06  173  	u16 expected_digest_size = 0;
7a1d7e6dd76a20 Jarkko Sakkinen 2014-12-12  174  
a5dbe6d43b61d5 Jarkko Sakkinen 2025-07-03  175  	struct tpm_buf *buf __free(kfree) = tpm_buf_alloc();
a5dbe6d43b61d5 Jarkko Sakkinen 2025-07-03  176  	if (!buf)
a5dbe6d43b61d5 Jarkko Sakkinen 2025-07-03  177  		return -ENOMEM;
a5dbe6d43b61d5 Jarkko Sakkinen 2025-07-03  178  
7a1d7e6dd76a20 Jarkko Sakkinen 2014-12-12  179  	if (pcr_idx >= TPM2_PLATFORM_PCR)
7a1d7e6dd76a20 Jarkko Sakkinen 2014-12-12  180  		return -EINVAL;
7a1d7e6dd76a20 Jarkko Sakkinen 2014-12-12  181  
879b589210a9a0 Roberto Sassu   2019-02-06  182  	if (!digest_size_ptr) {
879b589210a9a0 Roberto Sassu   2019-02-06  183  		for (i = 0; i < chip->nr_allocated_banks &&
879b589210a9a0 Roberto Sassu   2019-02-06  184  		     chip->allocated_banks[i].alg_id != digest->alg_id; i++)
879b589210a9a0 Roberto Sassu   2019-02-06  185  			;
879b589210a9a0 Roberto Sassu   2019-02-06  186  
879b589210a9a0 Roberto Sassu   2019-02-06  187  		if (i == chip->nr_allocated_banks)
879b589210a9a0 Roberto Sassu   2019-02-06  188  			return -EINVAL;
879b589210a9a0 Roberto Sassu   2019-02-06  189  
879b589210a9a0 Roberto Sassu   2019-02-06  190  		expected_digest_size = chip->allocated_banks[i].digest_size;
879b589210a9a0 Roberto Sassu   2019-02-06  191  	}
879b589210a9a0 Roberto Sassu   2019-02-06  192  
a5dbe6d43b61d5 Jarkko Sakkinen 2025-07-03  193  	tpm_buf_reset(buf, TPM2_ST_NO_SESSIONS, TPM2_CC_PCR_READ);
91f7f3d773a469 Roberto Sassu   2017-06-23  194  
91f7f3d773a469 Roberto Sassu   2017-06-23  195  	pcr_select[pcr_idx >> 3] = 1 << (pcr_idx & 0x7);
91f7f3d773a469 Roberto Sassu   2017-06-23  196  
a5dbe6d43b61d5 Jarkko Sakkinen 2025-07-03  197  	tpm_buf_append_u32(buf, 1);
a5dbe6d43b61d5 Jarkko Sakkinen 2025-07-03  198  	tpm_buf_append_u16(buf, digest->alg_id);
a5dbe6d43b61d5 Jarkko Sakkinen 2025-07-03  199  	tpm_buf_append_u8(buf, TPM2_PCR_SELECT_MIN);
a5dbe6d43b61d5 Jarkko Sakkinen 2025-07-03  200  	tpm_buf_append(buf, (const unsigned char *)pcr_select,
91f7f3d773a469 Roberto Sassu   2017-06-23  201  		       sizeof(pcr_select));
91f7f3d773a469 Roberto Sassu   2017-06-23  202  
a5dbe6d43b61d5 Jarkko Sakkinen 2025-07-03  203  	rc = tpm_transmit_cmd(chip, buf, 0, "attempting to read a pcr value");
879b589210a9a0 Roberto Sassu   2019-02-06  204  	if (rc)
a5dbe6d43b61d5 Jarkko Sakkinen 2025-07-03  205  		return rc;
879b589210a9a0 Roberto Sassu   2019-02-06  206  
a5dbe6d43b61d5 Jarkko Sakkinen 2025-07-03  207  	out = (struct tpm2_pcr_read_out *)&buf->data[TPM_HEADER_SIZE];
879b589210a9a0 Roberto Sassu   2019-02-06  208  	digest_size = be16_to_cpu(out->digest_size);
879b589210a9a0 Roberto Sassu   2019-02-06  209  	if (digest_size > sizeof(digest->digest) ||
a5dbe6d43b61d5 Jarkko Sakkinen 2025-07-03  210  	    (!digest_size_ptr && digest_size != expected_digest_size))
a5dbe6d43b61d5 Jarkko Sakkinen 2025-07-03 @211  		return rc;
7a1d7e6dd76a20 Jarkko Sakkinen 2014-12-12  212  
879b589210a9a0 Roberto Sassu   2019-02-06  213  	if (digest_size_ptr)
879b589210a9a0 Roberto Sassu   2019-02-06  214  		*digest_size_ptr = digest_size;
879b589210a9a0 Roberto Sassu   2019-02-06  215  
879b589210a9a0 Roberto Sassu   2019-02-06  216  	memcpy(digest->digest, out->digest, digest_size);
7a1d7e6dd76a20 Jarkko Sakkinen 2014-12-12  217  	return rc;
7a1d7e6dd76a20 Jarkko Sakkinen 2014-12-12  218  }
7a1d7e6dd76a20 Jarkko Sakkinen 2014-12-12  219  

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

             reply	other threads:[~2025-07-06 13:56 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-06 13:56 kernel test robot [this message]
  -- strict thread matches above, loose matches on Subject: below --
2025-07-03 18:17 [PATCH v5] tpm: Managed allocations for tpm_buf instances Jarkko Sakkinen
2025-07-03 20:21 ` Stefan Berger
2025-07-04  2:53   ` Jarkko Sakkinen
2025-07-14 19:09 ` Dan Carpenter

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=202507062112.JKYfCa34-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=error27@gmail.com \
    --cc=oe-kbuild@lists.linux.dev \
    /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.