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, Julia Lawall <julia.lawall@inria.fr>
Subject: drivers/nvme/common/keyring.c:117:14-21: WARNING: Consider using %pe to print PTR_ERR()
Date: Wed, 29 Oct 2025 00:27:06 +0800	[thread overview]
Message-ID: <202510290001.7fbZ12C3-lkp@intel.com> (raw)

BCC: lkp@intel.com
CC: oe-kbuild-all@lists.linux.dev
CC: linux-kernel@vger.kernel.org
TO: Hannes Reinecke <hare@kernel.org>
CC: Keith Busch <kbusch@kernel.org>
CC: Sagi Grimberg <sagi@grimberg.me>

Hi Hannes,

First bad commit (maybe != root cause):

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   fd57572253bc356330dbe5b233c2e1d8426c66fd
commit: e88a7595b57f2a04f1be796419444b4a14a55d18 nvme-tcp: request secure channel concatenation
date:   7 months ago
:::::: branch date: 23 hours ago
:::::: commit date: 7 months ago
config: i386-randconfig-052-20251028 (https://download.01.org/0day-ci/archive/20251029/202510290001.7fbZ12C3-lkp@intel.com/config)
compiler: gcc-14 (Debian 14.2.0-19) 14.2.0

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: Julia Lawall <julia.lawall@inria.fr>
| Closes: https://lore.kernel.org/r/202510290001.7fbZ12C3-lkp@intel.com/

cocci warnings: (new ones prefixed by >>)
>> drivers/nvme/common/keyring.c:117:14-21: WARNING: Consider using %pe to print PTR_ERR()
   drivers/nvme/common/keyring.c:175:14-21: WARNING: Consider using %pe to print PTR_ERR()

vim +117 drivers/nvme/common/keyring.c

3bac969b16b7bc3 Hannes Reinecke 2023-08-24   90  
3bac969b16b7bc3 Hannes Reinecke 2023-08-24   91  static struct key *nvme_tls_psk_lookup(struct key *keyring,
3bac969b16b7bc3 Hannes Reinecke 2023-08-24   92  		const char *hostnqn, const char *subnqn,
79559c753324589 Hannes Reinecke 2024-07-22   93  		u8 hmac, u8 psk_ver, bool generated)
3bac969b16b7bc3 Hannes Reinecke 2023-08-24   94  {
3bac969b16b7bc3 Hannes Reinecke 2023-08-24   95  	char *identity;
3bac969b16b7bc3 Hannes Reinecke 2023-08-24   96  	size_t identity_len = (NVMF_NQN_SIZE) * 2 + 11;
3bac969b16b7bc3 Hannes Reinecke 2023-08-24   97  	key_ref_t keyref;
3bac969b16b7bc3 Hannes Reinecke 2023-08-24   98  	key_serial_t keyring_id;
3bac969b16b7bc3 Hannes Reinecke 2023-08-24   99  
3bac969b16b7bc3 Hannes Reinecke 2023-08-24  100  	identity = kzalloc(identity_len, GFP_KERNEL);
3bac969b16b7bc3 Hannes Reinecke 2023-08-24  101  	if (!identity)
3bac969b16b7bc3 Hannes Reinecke 2023-08-24  102  		return ERR_PTR(-ENOMEM);
3bac969b16b7bc3 Hannes Reinecke 2023-08-24  103  
79559c753324589 Hannes Reinecke 2024-07-22  104  	snprintf(identity, identity_len, "NVMe%u%c%02u %s %s",
79559c753324589 Hannes Reinecke 2024-07-22  105  		 psk_ver, generated ? 'G' : 'R', hmac, hostnqn, subnqn);
3bac969b16b7bc3 Hannes Reinecke 2023-08-24  106  
3bac969b16b7bc3 Hannes Reinecke 2023-08-24  107  	if (!keyring)
3bac969b16b7bc3 Hannes Reinecke 2023-08-24  108  		keyring = nvme_keyring;
3bac969b16b7bc3 Hannes Reinecke 2023-08-24  109  	keyring_id = key_serial(keyring);
3bac969b16b7bc3 Hannes Reinecke 2023-08-24  110  	pr_debug("keyring %x lookup tls psk '%s'\n",
3bac969b16b7bc3 Hannes Reinecke 2023-08-24  111  		 keyring_id, identity);
3bac969b16b7bc3 Hannes Reinecke 2023-08-24  112  	keyref = keyring_search(make_key_ref(keyring, true),
3bac969b16b7bc3 Hannes Reinecke 2023-08-24  113  				&nvme_tls_psk_key_type,
3bac969b16b7bc3 Hannes Reinecke 2023-08-24  114  				identity, false);
3bac969b16b7bc3 Hannes Reinecke 2023-08-24  115  	if (IS_ERR(keyref)) {
3bac969b16b7bc3 Hannes Reinecke 2023-08-24  116  		pr_debug("lookup tls psk '%s' failed, error %ld\n",
3bac969b16b7bc3 Hannes Reinecke 2023-08-24 @117  			 identity, PTR_ERR(keyref));
3bac969b16b7bc3 Hannes Reinecke 2023-08-24  118  		kfree(identity);
3bac969b16b7bc3 Hannes Reinecke 2023-08-24  119  		return ERR_PTR(-ENOKEY);
3bac969b16b7bc3 Hannes Reinecke 2023-08-24  120  	}
3bac969b16b7bc3 Hannes Reinecke 2023-08-24  121  	kfree(identity);
3bac969b16b7bc3 Hannes Reinecke 2023-08-24  122  
3bac969b16b7bc3 Hannes Reinecke 2023-08-24  123  	return key_ref_to_ptr(keyref);
3bac969b16b7bc3 Hannes Reinecke 2023-08-24  124  }
3bac969b16b7bc3 Hannes Reinecke 2023-08-24  125  

:::::: The code at line 117 was first introduced by commit
:::::: 3bac969b16b7bc304ba56d030847920fc7073a91 nvme-keyring: define a 'psk' keytype

:::::: TO: Hannes Reinecke <hare@suse.de>
:::::: CC: Keith Busch <kbusch@kernel.org>

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

                 reply	other threads:[~2025-10-28 16:28 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=202510290001.7fbZ12C3-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=julia.lawall@inria.fr \
    --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.