All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Hannes Reinecke <hare@kernel.org>,
	Keith Busch <kbusch@kernel.org>, Jens Axboe <axboe@kernel.dk>,
	Christoph Hellwig <hch@lst.de>, Sagi Grimberg <sagi@grimberg.me>,
	Hannes Reinecke <hare@suse.de>,
	Chaitanya Kulkarni <kch@nvidia.com>
Cc: llvm@lists.linux.dev, oe-kbuild-all@lists.linux.dev,
	linux-nvme@lists.infradead.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v4 2/9] nvme-keyring: add 'dhchap' key type
Date: Sat, 21 Nov 2026 04:11:20 +0800	[thread overview]
Message-ID: <202611210348.KYpQPgoE-lkp@intel.com> (raw)
In-Reply-To: <20261120-dhchap-keyring-v4-v4-2-5f8c7d9926ee@kernel.org>

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


  parent reply	other threads:[~2026-11-20 20:12 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-20 11:13 [PATCH v4 0/9] nvme-auth: switch to use the kernel keyring Hannes Reinecke
2026-11-20 11:14 ` [PATCH v4 1/9] nvme-auth: modify nvme_auth_transform_key() to return status Hannes Reinecke
2026-11-20 11:19   ` sashiko-bot
2026-11-20 11:42     ` Hannes Reinecke
2026-11-20 11:14 ` [PATCH v4 2/9] nvme-keyring: add 'dhchap' key type Hannes Reinecke
2026-11-20 11:28   ` sashiko-bot
2026-11-20 12:28     ` Hannes Reinecke
2026-11-20 20:11   ` kernel test robot [this message]
2026-11-20 11:14 ` [PATCH v4 3/9] nvme-auth: switch to use 'struct key' Hannes Reinecke
2026-11-20 11:31   ` sashiko-bot
2026-11-20 13:08     ` Hannes Reinecke
2026-11-20 19:24   ` kernel test robot
2026-11-20 19:37   ` kernel test robot
2026-11-20 11:14 ` [PATCH v4 4/9] nvme: parse dhchap keys during option parsing Hannes Reinecke
2026-11-20 11:32   ` sashiko-bot
2026-11-20 13:55     ` Hannes Reinecke
2026-11-20 11:14 ` [PATCH v4 5/9] nvmet-auth: parse dhchap key from configfs attribute Hannes Reinecke
2026-11-20 11:28   ` sashiko-bot
2026-11-20 14:15     ` Hannes Reinecke
2026-11-20 11:14 ` [PATCH v4 6/9] nvme: allow to pass in key description as dhchap secret Hannes Reinecke
2026-11-20 11:31   ` sashiko-bot
2026-11-20 14:48     ` Hannes Reinecke
2026-11-20 11:14 ` [PATCH v4 7/9] nvme-auth: wait for authentication to finish when changing keys Hannes Reinecke
2026-11-20 11:26   ` sashiko-bot
2026-11-20 14:52     ` Hannes Reinecke
2026-11-20 11:14 ` [PATCH v4 8/9] nvme-fabrics: allow to pass in keyring by name Hannes Reinecke
2026-11-20 11:37   ` sashiko-bot
2026-11-20 15:02     ` Hannes Reinecke
2026-11-20 11:14 ` [PATCH v4 9/9] nvmet: add configfs attribute 'dhchap_keyring' Hannes Reinecke
2026-11-20 11:39   ` sashiko-bot
2026-11-20 15:27     ` Hannes Reinecke

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=202611210348.KYpQPgoE-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=axboe@kernel.dk \
    --cc=hare@kernel.org \
    --cc=hare@suse.de \
    --cc=hch@lst.de \
    --cc=kbusch@kernel.org \
    --cc=kch@nvidia.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-nvme@lists.infradead.org \
    --cc=llvm@lists.linux.dev \
    --cc=oe-kbuild-all@lists.linux.dev \
    --cc=sagi@grimberg.me \
    /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.