All of lore.kernel.org
 help / color / mirror / Atom feed
* [jarkko-tpmdd:tpm2key-v3 7/7] crypto/asymmetric_keys/tpm2_key_rsa.c:360:1: warning: unused label 'err_auth'
@ 2024-05-23  7:51 kernel test robot
  0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2024-05-23  7:51 UTC (permalink / raw)
  To: James Prestwood; +Cc: llvm, oe-kbuild-all, Jarkko Sakkinen

tree:   git://git.kernel.org/pub/scm/linux/kernel/git/jarkko/linux-tpmdd.git tpm2key-v3
head:   9e82832aa16a3b33db19220c360342be336b77d2
commit: 9e82832aa16a3b33db19220c360342be336b77d2 [7/7] keys: asymmetric: ASYMMETRIC_TPM2_KEY_RSA_SUBTYPE
config: hexagon-allmodconfig (https://download.01.org/0day-ci/archive/20240523/202405231543.2UgLiw4L-lkp@intel.com/config)
compiler: clang version 19.0.0git (https://github.com/llvm/llvm-project fa9b1be45088dce1e4b602d451f118128b94237b)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240523/202405231543.2UgLiw4L-lkp@intel.com/reproduce)

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/202405231543.2UgLiw4L-lkp@intel.com/

All warnings (new ones prefixed by >>):

   In file included from crypto/asymmetric_keys/tpm2_key_rsa.c:16:
   In file included from include/keys/trusted-type.h:12:
   In file included from include/linux/tpm.h:24:
   In file included from include/linux/highmem.h:10:
   In file included from include/linux/mm.h:2253:
   include/linux/vmstat.h:514:36: warning: arithmetic between different enumeration types ('enum node_stat_item' and 'enum lru_list') [-Wenum-enum-conversion]
     514 |         return node_stat_name(NR_LRU_BASE + lru) + 3; // skip "nr_"
         |                               ~~~~~~~~~~~ ^ ~~~
   In file included from crypto/asymmetric_keys/tpm2_key_rsa.c:16:
   In file included from include/keys/trusted-type.h:12:
   In file included from include/linux/tpm.h:24:
   In file included from include/linux/highmem.h:12:
   In file included from include/linux/hardirq.h:11:
   In file included from ./arch/hexagon/include/generated/asm/hardirq.h:1:
   In file included from include/asm-generic/hardirq.h:17:
   In file included from include/linux/irq.h:20:
   In file included from include/linux/io.h:14:
   In file included from arch/hexagon/include/asm/io.h:328:
   include/asm-generic/io.h:548:31: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
     548 |         val = __raw_readb(PCI_IOBASE + addr);
         |                           ~~~~~~~~~~ ^
   include/asm-generic/io.h:561:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
     561 |         val = __le16_to_cpu((__le16 __force)__raw_readw(PCI_IOBASE + addr));
         |                                                         ~~~~~~~~~~ ^
   include/uapi/linux/byteorder/little_endian.h:37:51: note: expanded from macro '__le16_to_cpu'
      37 | #define __le16_to_cpu(x) ((__force __u16)(__le16)(x))
         |                                                   ^
   In file included from crypto/asymmetric_keys/tpm2_key_rsa.c:16:
   In file included from include/keys/trusted-type.h:12:
   In file included from include/linux/tpm.h:24:
   In file included from include/linux/highmem.h:12:
   In file included from include/linux/hardirq.h:11:
   In file included from ./arch/hexagon/include/generated/asm/hardirq.h:1:
   In file included from include/asm-generic/hardirq.h:17:
   In file included from include/linux/irq.h:20:
   In file included from include/linux/io.h:14:
   In file included from arch/hexagon/include/asm/io.h:328:
   include/asm-generic/io.h:574:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
     574 |         val = __le32_to_cpu((__le32 __force)__raw_readl(PCI_IOBASE + addr));
         |                                                         ~~~~~~~~~~ ^
   include/uapi/linux/byteorder/little_endian.h:35:51: note: expanded from macro '__le32_to_cpu'
      35 | #define __le32_to_cpu(x) ((__force __u32)(__le32)(x))
         |                                                   ^
   In file included from crypto/asymmetric_keys/tpm2_key_rsa.c:16:
   In file included from include/keys/trusted-type.h:12:
   In file included from include/linux/tpm.h:24:
   In file included from include/linux/highmem.h:12:
   In file included from include/linux/hardirq.h:11:
   In file included from ./arch/hexagon/include/generated/asm/hardirq.h:1:
   In file included from include/asm-generic/hardirq.h:17:
   In file included from include/linux/irq.h:20:
   In file included from include/linux/io.h:14:
   In file included from arch/hexagon/include/asm/io.h:328:
   include/asm-generic/io.h:585:33: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
     585 |         __raw_writeb(value, PCI_IOBASE + addr);
         |                             ~~~~~~~~~~ ^
   include/asm-generic/io.h:595:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
     595 |         __raw_writew((u16 __force)cpu_to_le16(value), PCI_IOBASE + addr);
         |                                                       ~~~~~~~~~~ ^
   include/asm-generic/io.h:605:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
     605 |         __raw_writel((u32 __force)cpu_to_le32(value), PCI_IOBASE + addr);
         |                                                       ~~~~~~~~~~ ^
   crypto/asymmetric_keys/tpm2_key_rsa.c:284:15: warning: unused variable 'offset' [-Wunused-variable]
     284 |         unsigned int offset = 0;
         |                      ^~~~~~
>> crypto/asymmetric_keys/tpm2_key_rsa.c:360:1: warning: unused label 'err_auth' [-Wunused-label]
     360 | err_auth:
         | ^~~~~~~~~
   9 warnings generated.


vim +/err_auth +360 crypto/asymmetric_keys/tpm2_key_rsa.c

   278	
   279	static int __tpm2_key_rsa_decrypt(struct tpm_chip *chip,
   280					  struct tpm2_key_rsa *key,
   281					  struct kernel_pkey_params *params,
   282					  const void *in, int in_len, void *out)
   283	{
   284		unsigned int offset = 0;
   285		u32 key_handle = 0;
   286		struct tpm_buf buf;
   287		u16 decrypted_len;
   288		u32 parent;
   289		u8 *pos;
   290		int ret;
   291	
   292		ret = tpm_try_get_ops(chip);
   293		if (ret)
   294			return ret;
   295	
   296		ret = tpm2_start_auth_session(chip);
   297		if (ret)
   298			goto err_ops;
   299	
   300		parent = key->key.parent;
   301	
   302		ret = tpm_buf_init(&buf, TPM2_ST_SESSIONS, TPM2_CC_LOAD);
   303		if (ret < 0)
   304			goto err_parent;
   305	
   306		tpm_buf_append_name(chip, &buf, parent, NULL);
   307		tpm_buf_append_hmac_session(chip, &buf, TPM2_SA_CONTINUE_SESSION |
   308					    TPM2_SA_ENCRYPT, NULL, 0);
   309		tpm_buf_append(&buf, key->key.blob, key->key.blob_len);
   310		if (buf.flags & TPM_BUF_OVERFLOW) {
   311			ret = -E2BIG;
   312			goto err_buf;
   313		}
   314		tpm_buf_fill_hmac_session(chip, &buf);
   315		ret = tpm_transmit_cmd(chip, &buf, 4, "RSA key loading");
   316		ret = tpm_buf_check_hmac_response(chip, &buf, ret);
   317		if (ret) {
   318			ret = -EIO;
   319			goto err_buf;
   320		}
   321		key_handle = be32_to_cpup((__be32 *)&buf.data[TPM_HEADER_SIZE]);
   322	
   323		tpm_buf_reset(&buf, TPM2_ST_SESSIONS, TPM2_CC_RSA_DECRYPT);
   324		tpm_buf_append_name(chip, &buf, key_handle, NULL);
   325		tpm_buf_append_hmac_session(chip, &buf, TPM2_SA_DECRYPT, NULL, 0);
   326		tpm_buf_append_u16(&buf, in_len);
   327		tpm_buf_append(&buf, in, in_len);
   328		tpm_buf_append_u16(&buf, TPM_ALG_NULL);
   329		tpm_buf_append_u16(&buf, 0);
   330		tpm_buf_fill_hmac_session(chip, &buf);
   331		ret = tpm_transmit_cmd(chip, &buf, 4, "RSA key decrypting");
   332		ret = tpm_buf_check_hmac_response(chip, &buf, ret);
   333		if (ret) {
   334			ret = -EIO;
   335			goto err_blob;
   336		}
   337	
   338		pos = buf.data + TPM_HEADER_SIZE + 4;
   339		decrypted_len = be16_to_cpup((__be16 *)pos);
   340		pos += 2;
   341	
   342		if (params->out_len < decrypted_len) {
   343			ret = -EMSGSIZE;
   344			goto err_blob;
   345		}
   346	
   347		memcpy(out, pos, decrypted_len);
   348		ret = decrypted_len;
   349	
   350	err_blob:
   351		tpm2_flush_context(chip, key_handle);
   352	
   353	err_buf:
   354		tpm_buf_destroy(&buf);
   355	
   356	err_parent:
   357		if (key->key.parent == TPM2_RH_NULL)
   358			tpm2_flush_context(chip, parent);
   359	
 > 360	err_auth:
   361		if (ret < 0)
   362			tpm2_end_auth_session(chip);
   363	
   364	err_ops:
   365		tpm_put_ops(chip);
   366		return ret;
   367	}
   368	

-- 
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:[~2024-05-23  7:56 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-05-23  7:51 [jarkko-tpmdd:tpm2key-v3 7/7] crypto/asymmetric_keys/tpm2_key_rsa.c:360:1: warning: unused label 'err_auth' kernel test robot

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.