* [hare-nvme:dhchap-keyring.v4 2/9] drivers/nvme/common/keyring.c:431:22: sparse: sparse: unsigned value that used to be signed checked against zero?
@ 2026-11-20 16:21 kernel test robot
0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2026-11-20 16:21 UTC (permalink / raw)
To: Hannes Reinecke; +Cc: oe-kbuild-all
tree: https://git.kernel.org/pub/scm/linux/kernel/git/hare/nvme.git dhchap-keyring.v4
head: 1b78746d90bfa570d96e88475983421f24c38b0d
commit: a6c7217c8a4b404d6107aeaf07b1323df6adbf32 [2/9] nvme-keyring: add 'dhchap' key type
config: s390-randconfig-r2302-20261120 (https://download.01.org/0day-ci/archive/20261120/20261120172009.jxwIXru2-lkp@intel.com/config)
compiler: s390-linux-gcc (GCC) 14.4.0
sparse: v0.6.5-rc1-21-g84ec0658
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20261120/20261120172009.jxwIXru2-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/20261120172009.jxwIXru2-lkp@intel.com/
sparse warnings: (new ones prefixed by >>)
>> drivers/nvme/common/keyring.c:431:22: sparse: sparse: unsigned value that used to be signed checked against zero?
drivers/nvme/common/keyring.c:430:68: sparse: signed value source
vim +431 drivers/nvme/common/keyring.c
396
397 /**
398 * nvme_dhchap_psk_read - read callback for dhchap key types
399 * @key: key to read from
400 * @buffer: buffer for the key contents
401 * @buflen: length of @buffer
402 *
403 * Formets the DH-HMAC-CHAP key in base64-encoded form as
404 * defined in the NVM Express TCP Transport Specification Rev 1.1,
405 * Section 3.6.1.5 'PSK Interchange Format'. The payload of @key
406 * is assumed to be of 'struct user_key_payload', with the data
407 * consisting of the key data of length 'upayload->datalen', followed
408 * by four bytes of CRC, one byte version, and one byte hmac fields.
409 */
410 static long nvme_dhchap_psk_read(const struct key *key,
411 char *buffer, size_t buflen)
412 {
413 const struct user_key_payload *upayload;
414 size_t datalen, keylen;
415 u8 version, hmac;
416 long ret;
417
418 upayload = user_key_payload_locked(key);
419 /*
420 * Expected output string length:
421 * strlen("DHHC-") +
422 * version (= 1) +
423 * ':' (= 1) +
424 * hmac (= 2) +
425 * ':' (= 1) +
426 * encoded base64 key length +
427 * CRC length (= 4) +
428 * ':' (= 1)
429 */
430 keylen = nvme_dhchap_decoded_key_size(upayload->datalen) + 15;
> 431 if (keylen < 0 || !buffer || buflen == 0)
432 return keylen;
433
434 if (buflen < keylen)
435 return -EINVAL;
436
437 memset(buffer, 0, buflen);
438 version = upayload->data[upayload->datalen + 4];
439 hmac = upayload->data[upayload->datalen + 5];
440 ret = sprintf(buffer, "DHHC-%01hhu:%02hhu:", version, hmac);
441 if (ret < 0)
442 return -ENOKEY;
443 /* Include the trailing CRC */
444 datalen = upayload->datalen + 4;
445 ret += base64_encode(upayload->data, datalen, buffer + ret,
446 true, BASE64_STD);
447 buffer[ret] = ':';
448 ret++;
449 return ret;
450 }
451
--
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 16:22 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-20 16:21 [hare-nvme:dhchap-keyring.v4 2/9] drivers/nvme/common/keyring.c:431:22: sparse: sparse: unsigned value that used to be signed checked against zero? 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.