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: [jarkko-tpmdd:hibernate 32/39] drivers/char/tpm/tpm2-rsp.h:112 tpm2_rsp_ecdsa_public() warn: was && intended here instead of ||?
Date: Tue, 10 Nov 2026 08:47:06 +0100	[thread overview]
Message-ID: <202611100802.66Q7bfro-lkp@intel.com> (raw)

Unfiltered warning: this smatch report is sent as-is and has not been
reviewed for false positives, so please treat it with due skepticism.

BCC: lkp@intel.com
CC: oe-kbuild-all@lists.linux.dev
TO: Jarkko Sakkinen <jarkko@kernel.org>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/jarkko/linux-tpmdd.git hibernate
head:   74bb07bc3885849d08ac7ab1942479559faa986c
commit: 53d3622f5f68be4ed89dbb5d232c14b56992ab56 [32/39] tpm: Move the bounds-checked response reader to a header
:::::: branch date: 7 hours ago
:::::: commit date: 7 hours ago
config: parisc-randconfig-2200-20261110 (https://download.01.org/0day-ci/archive/20261110/202611100802.66Q7bfro-lkp@intel.com/config)
compiler: hppa-linux-gcc (GCC) 15.3.0
smatch: v0.5.0-9187-g5189e3fb

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/202611100802.66Q7bfro-lkp@intel.com/

New smatch warnings:
drivers/char/tpm/tpm2-rsp.h:112 tpm2_rsp_ecdsa_public() warn: was && intended here instead of ||?

Old smatch warnings:
drivers/char/tpm/tpm2-ak.c:253 tpm2_get_signed_audit_digest() warn: was && intended here instead of ||?

vim +112 drivers/char/tpm/tpm2-rsp.h

53d3622f5f68be Matthew Garrett 2026-10-08  100  
53d3622f5f68be Matthew Garrett 2026-10-08  101  /*
53d3622f5f68be Matthew Garrett 2026-10-08  102   * Parse a TPM2B_PUBLIC for an ECDSA-SHA256 P-256 signing key with no
53d3622f5f68be Matthew Garrett 2026-10-08  103   * symmetric algorithm, KDF or policy, checking that it has exactly the
53d3622f5f68be Matthew Garrett 2026-10-08  104   * object attributes @attrs, and return its public point.
53d3622f5f68be Matthew Garrett 2026-10-08  105   */
53d3622f5f68be Matthew Garrett 2026-10-08  106  static inline int tpm2_rsp_ecdsa_public(struct tpm2_rsp *r, u32 attrs,
53d3622f5f68be Matthew Garrett 2026-10-08  107  					u8 *x, u8 *y)
53d3622f5f68be Matthew Garrett 2026-10-08  108  {
53d3622f5f68be Matthew Garrett 2026-10-08  109  	u16 size = tpm2_rsp_u16(r);
53d3622f5f68be Matthew Garrett 2026-10-08  110  	u32 end = r->off + size;
53d3622f5f68be Matthew Garrett 2026-10-08  111  
53d3622f5f68be Matthew Garrett 2026-10-08 @112  	if (tpm2_rsp_u16(r) != TPM_ALG_ECC ||
53d3622f5f68be Matthew Garrett 2026-10-08  113  	    tpm2_rsp_u16(r) != TPM_ALG_SHA256 ||
53d3622f5f68be Matthew Garrett 2026-10-08  114  	    tpm2_rsp_u32(r) != attrs ||
53d3622f5f68be Matthew Garrett 2026-10-08  115  	    tpm2_rsp_u16(r) != 0 ||			/* authPolicy */
53d3622f5f68be Matthew Garrett 2026-10-08  116  	    tpm2_rsp_u16(r) != TPM_ALG_NULL ||		/* symmetric */
53d3622f5f68be Matthew Garrett 2026-10-08  117  	    tpm2_rsp_u16(r) != TPM_ALG_ECDSA ||		/* scheme */
53d3622f5f68be Matthew Garrett 2026-10-08  118  	    tpm2_rsp_u16(r) != TPM_ALG_SHA256 ||	/* scheme hash */
53d3622f5f68be Matthew Garrett 2026-10-08  119  	    tpm2_rsp_u16(r) != TPM2_ECC_NIST_P256 ||
53d3622f5f68be Matthew Garrett 2026-10-08  120  	    tpm2_rsp_u16(r) != TPM_ALG_NULL)		/* kdf */
53d3622f5f68be Matthew Garrett 2026-10-08  121  		return -EINVAL;
53d3622f5f68be Matthew Garrett 2026-10-08  122  
53d3622f5f68be Matthew Garrett 2026-10-08  123  	tpm2_rsp_ecc_param(r, x);
53d3622f5f68be Matthew Garrett 2026-10-08  124  	tpm2_rsp_ecc_param(r, y);
53d3622f5f68be Matthew Garrett 2026-10-08  125  
53d3622f5f68be Matthew Garrett 2026-10-08  126  	if (r->err || r->off != end)
53d3622f5f68be Matthew Garrett 2026-10-08  127  		return -EINVAL;
53d3622f5f68be Matthew Garrett 2026-10-08  128  
53d3622f5f68be Matthew Garrett 2026-10-08  129  	return 0;
53d3622f5f68be Matthew Garrett 2026-10-08  130  }
53d3622f5f68be Matthew Garrett 2026-10-08  131  

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

                 reply	other threads:[~2026-11-10  7:47 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=202611100802.66Q7bfro-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.