Building the Linux kernel with Clang and LLVM
 help / color / mirror / Atom feed
* Re: [PATCH v4 2/9] nvme-keyring: add 'dhchap' key type
       [not found] <20261120-dhchap-keyring-v4-v4-2-5f8c7d9926ee@kernel.org>
@ 2026-11-20 20:11 ` kernel test robot
  0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2026-11-20 20:11 UTC (permalink / raw)
  To: Hannes Reinecke, Keith Busch, Jens Axboe, Christoph Hellwig,
	Sagi Grimberg, Hannes Reinecke, Chaitanya Kulkarni
  Cc: llvm, oe-kbuild-all, linux-nvme, linux-kernel

Hi Hannes,

kernel test robot noticed the following build warnings:

[auto build test WARNING on 68099cf27253a8c89d703a282d3d811446d9453b]

url:    https://github.com/intel-lab-lkp/linux/commits/Hannes-Reinecke/nvme-auth-modify-nvme_auth_transform_key-to-return-status/20261120-121400
base:   68099cf27253a8c89d703a282d3d811446d9453b
patch link:    https://lore.kernel.org/r/20261120-dhchap-keyring-v4-v4-2-5f8c7d9926ee%40kernel.org
patch subject: [PATCH v4 2/9] nvme-keyring: add 'dhchap' key type
config: s390-defconfig (https://download.01.org/0day-ci/archive/20261121/202611210348.KYpQPgoE-lkp@intel.com/config)
compiler: clang version 18.1.8 (https://github.com/llvm/llvm-project 3b5b5c1ec4a3095ab096dd780e84d7ab81f3d7ff)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20261121/202611210348.KYpQPgoE-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/202611210348.KYpQPgoE-lkp@intel.com/

All warnings (new ones prefixed by >>):

>> drivers/nvme/common/keyring.c:348:19: warning: variable 'keylen' is uninitialized when used here [-Wuninitialized]
     348 |         prep->quotalen = keylen;
         |                          ^~~~~~
   drivers/nvme/common/keyring.c:310:40: note: initialize the variable 'keylen' to silence this warning
     310 |         size_t datalen = prep->datalen, keylen;
         |                                               ^
         |                                                = 0
   1 warning generated.


vim +/keylen +348 drivers/nvme/common/keyring.c

   293	
   294	/**
   295	 * nvme_dhchap_psk_preparse - prepare DH-HMAC-CHAP key data
   296	 * @prep: preparsed payload of the key data
   297	 *
   298	 * Decode the DH-HMAC-CHAP key data passed in @prep and
   299	 * store the resulting binary data. The binary data includes
   300	 * space for the CRC, the version, and the hmac identifier,
   301	 * but the data length is just the key data without the CRC.
   302	 * This allows the user to read the key data via the
   303	 * 'user_read()' function. The additional 'version' ahd 'hmac'
   304	 * data is used in the ->read() callback to generate the
   305	 * base64 encoded key.
   306	 */
   307	static int nvme_dhchap_psk_preparse(struct key_preparsed_payload *prep)
   308	{
   309		struct user_key_payload *upayload;
   310		size_t datalen = prep->datalen, keylen;
   311		int ret;
   312		u32 crc;
   313		u8 version, hmac;
   314	
   315		if (!prep->data) {
   316			pr_debug("%s: Empty data", __func__);
   317			prep->payload.data[0] = NULL;
   318			prep->quotalen = 0;
   319			return -EINVAL;
   320		}
   321	
   322		if (sscanf(prep->data, "DHHC-%01hhu:%02hhu:%*s",
   323			   &version, &hmac) != 2) {
   324			pr_debug("%s: invalid key data '%s'\n", __func__,
   325				 (char *)prep->data);
   326			prep->payload.data[0] = NULL;
   327			prep->quotalen = 0;
   328			return -EINVAL;
   329		}
   330	
   331		/* skip header and final ':' character */
   332		datalen -= 11;
   333	
   334		/*
   335		 * payload is < key | version | hmac >
   336		 * base64 decode will always return less data
   337		 * than the encoded data, so allocating the size
   338		 * of the encoded data will be large enough.
   339		 */
   340		upayload = kzalloc(sizeof(*upayload) + datalen, GFP_KERNEL);
   341		if (!upayload) {
   342			prep->payload.data[0] = NULL;
   343			prep->quotalen = 0;
   344			return -ENOMEM;
   345		}
   346	
   347		/* decode the data */
 > 348		prep->quotalen = keylen;
   349		prep->payload.data[0] = upayload;
   350		ret = base64_decode(prep->data + 10, datalen, upayload->data,
   351				    true, BASE64_STD);
   352		if (ret < 0) {
   353			pr_debug("%s: Failed to decode key %s\n",
   354				 __func__, (char *)prep->data + 10);
   355			return ret;
   356		}
   357		ret -= 4;
   358		crc = ~crc32(~0, upayload->data, ret);
   359		if (get_unaligned_le32(upayload->data + ret) != crc) {
   360			pr_debug("%s: CRC mismatch for key\n", __func__);
   361			/* CRC mismatch */
   362			return -EKEYREJECTED;
   363		}
   364		/* append version and hmac to the payload */
   365		upayload->data[ret + 4] = version;
   366		upayload->data[ret + 5] = hmac;
   367		upayload->datalen = ret;
   368		return 0;
   369	}
   370	

-- 
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:[~2026-11-20 20:11 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20261120-dhchap-keyring-v4-v4-2-5f8c7d9926ee@kernel.org>
2026-11-20 20:11 ` [PATCH v4 2/9] nvme-keyring: add 'dhchap' key type 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