Hi Hannes,
I love your patch! Perhaps something to improve:
[auto build test WARNING on linus/master]
[also build test WARNING on v5.14 next-20210910]
[cannot apply to cryptodev/master crypto/master linux-nvme/for-next]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url:
https://github.com/0day-ci/linux/commits/Hannes-Reinecke/nvme-In-band-aut...
base:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
bf9f243f23e6623f310ba03fbb14e10ec3a61290
config: powerpc-randconfig-s032-20210911 (attached as .config)
compiler: powerpc64-linux-gcc (GCC) 11.2.0
reproduce:
wget
https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O
~/bin/make.cross
chmod +x ~/bin/make.cross
# apt-get install sparse
# sparse version: v0.6.4-dirty
#
https://github.com/0day-ci/linux/commit/8b89de04a6eef68be62dcebf344e946c3...
git remote add linux-review
https://github.com/0day-ci/linux
git fetch --no-tags linux-review
Hannes-Reinecke/nvme-In-band-authentication-support/20210910-144627
git checkout 8b89de04a6eef68be62dcebf344e946c3e6843de
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross C=1
CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=powerpc
SHELL=/bin/bash drivers/nvme/host/ drivers/nvme/target/
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
sparse warnings: (new ones prefixed by >>)
> drivers/nvme/host/auth.c:235:24: sparse: sparse: Using plain
integer as NULL pointer
> drivers/nvme/host/auth.c:509:26: sparse: sparse: incorrect type in assignment
(different base types) @@ expected restricted __le32 [assigned] [usertype] tl @@
got unsigned long [usertype] tl @@
drivers/nvme/host/auth.c:509:26: sparse:
expected restricted __le32 [assigned] [usertype] tl
drivers/nvme/host/auth.c:509:26: sparse: got unsigned long [usertype] tl
> drivers/nvme/host/auth.c:537:29: sparse: sparse: incorrect type
in assignment (different base types) @@ expected restricted __le32 [assigned]
[usertype] al @@ got unsigned long [usertype] al @@
drivers/nvme/host/auth.c:537:29: sparse: expected restricted __le32 [assigned]
[usertype] al
drivers/nvme/host/auth.c:537:29: sparse: got unsigned long [usertype] al
> drivers/nvme/host/auth.c:618:54: sparse: sparse: restricted
__le16 degrades to integer
> drivers/nvme/host/auth.c:735:46: sparse: sparse: incorrect type in argument 1
(different base types) @@ expected unsigned long [usertype] size @@ got restricted
__le16 [usertype] dhvlen @@
drivers/nvme/host/auth.c:735:46: sparse: expected
unsigned long [usertype] size
drivers/nvme/host/auth.c:735:46: sparse: got restricted __le16 [usertype] dhvlen
> drivers/nvme/host/auth.c:738:36: sparse: sparse: incorrect type
in assignment (different base types) @@ expected int ctrl_key_len @@ got
restricted __le16 [usertype] dhvlen @@
drivers/nvme/host/auth.c:738:36: sparse:
expected int ctrl_key_len
drivers/nvme/host/auth.c:738:36: sparse: got restricted __le16 [usertype] dhvlen
drivers/nvme/host/auth.c:740:28: sparse: sparse: incorrect type in argument 3
(different base types) @@ expected unsigned long [usertype] size @@ got restricted
__le16 [usertype] dhvlen @@
drivers/nvme/host/auth.c:740:28: sparse: expected unsigned long [usertype] size
drivers/nvme/host/auth.c:740:28: sparse: got restricted __le16 [usertype] dhvlen
> drivers/nvme/host/auth.c:773:22: sparse: sparse: incorrect type
in assignment (different base types) @@ expected restricted __le16 [usertype] dhvlen
@@ got int host_key_len @@
drivers/nvme/host/auth.c:773:22: sparse:
expected restricted __le16 [usertype] dhvlen
drivers/nvme/host/auth.c:773:22: sparse: got int host_key_len
vim +235 drivers/nvme/host/auth.c
0f7847d23405a2 Hannes Reinecke 2021-09-10 224
0f7847d23405a2 Hannes Reinecke 2021-09-10 225 u8 *nvme_auth_transform_key(u8 *key,
size_t key_len, u8 key_hash, char *nqn)
0f7847d23405a2 Hannes Reinecke 2021-09-10 226 {
0f7847d23405a2 Hannes Reinecke 2021-09-10 227 const char *hmac_name =
nvme_auth_hmac_name(key_hash);
0f7847d23405a2 Hannes Reinecke 2021-09-10 228 struct crypto_shash *key_tfm;
0f7847d23405a2 Hannes Reinecke 2021-09-10 229 struct shash_desc *shash;
0f7847d23405a2 Hannes Reinecke 2021-09-10 230 u8 *transformed_key;
0f7847d23405a2 Hannes Reinecke 2021-09-10 231 int ret;
0f7847d23405a2 Hannes Reinecke 2021-09-10 232
0f7847d23405a2 Hannes Reinecke 2021-09-10 233 /* No key transformation required */
0f7847d23405a2 Hannes Reinecke 2021-09-10 234 if (key_hash == 0)
0f7847d23405a2 Hannes Reinecke 2021-09-10 @235 return 0;
0f7847d23405a2 Hannes Reinecke 2021-09-10 236
0f7847d23405a2 Hannes Reinecke 2021-09-10 237 hmac_name =
nvme_auth_hmac_name(key_hash);
0f7847d23405a2 Hannes Reinecke 2021-09-10 238 if (!hmac_name) {
0f7847d23405a2 Hannes Reinecke 2021-09-10 239 pr_warn("Invalid key hash id
%d\n", key_hash);
0f7847d23405a2 Hannes Reinecke 2021-09-10 240 return ERR_PTR(-EKEYREJECTED);
0f7847d23405a2 Hannes Reinecke 2021-09-10 241 }
0f7847d23405a2 Hannes Reinecke 2021-09-10 242 key_tfm = crypto_alloc_shash(hmac_name,
0, 0);
0f7847d23405a2 Hannes Reinecke 2021-09-10 243 if (IS_ERR(key_tfm))
0f7847d23405a2 Hannes Reinecke 2021-09-10 244 return (u8 *)key_tfm;
0f7847d23405a2 Hannes Reinecke 2021-09-10 245
0f7847d23405a2 Hannes Reinecke 2021-09-10 246 shash = kmalloc(sizeof(struct shash_desc)
+
0f7847d23405a2 Hannes Reinecke 2021-09-10 247 crypto_shash_descsize(key_tfm),
0f7847d23405a2 Hannes Reinecke 2021-09-10 248 GFP_KERNEL);
0f7847d23405a2 Hannes Reinecke 2021-09-10 249 if (!shash) {
0f7847d23405a2 Hannes Reinecke 2021-09-10 250 crypto_free_shash(key_tfm);
0f7847d23405a2 Hannes Reinecke 2021-09-10 251 return ERR_PTR(-ENOMEM);
0f7847d23405a2 Hannes Reinecke 2021-09-10 252 }
0f7847d23405a2 Hannes Reinecke 2021-09-10 253 transformed_key =
kzalloc(crypto_shash_digestsize(key_tfm), GFP_KERNEL);
0f7847d23405a2 Hannes Reinecke 2021-09-10 254 if (!transformed_key) {
0f7847d23405a2 Hannes Reinecke 2021-09-10 255 ret = -ENOMEM;
0f7847d23405a2 Hannes Reinecke 2021-09-10 256 goto out_free_shash;
0f7847d23405a2 Hannes Reinecke 2021-09-10 257 }
0f7847d23405a2 Hannes Reinecke 2021-09-10 258
0f7847d23405a2 Hannes Reinecke 2021-09-10 259 shash->tfm = key_tfm;
0f7847d23405a2 Hannes Reinecke 2021-09-10 260 ret = crypto_shash_setkey(key_tfm, key,
key_len);
0f7847d23405a2 Hannes Reinecke 2021-09-10 261 if (ret < 0)
0f7847d23405a2 Hannes Reinecke 2021-09-10 262 goto out_free_shash;
0f7847d23405a2 Hannes Reinecke 2021-09-10 263 ret = crypto_shash_init(shash);
0f7847d23405a2 Hannes Reinecke 2021-09-10 264 if (ret < 0)
0f7847d23405a2 Hannes Reinecke 2021-09-10 265 goto out_free_shash;
0f7847d23405a2 Hannes Reinecke 2021-09-10 266 ret = crypto_shash_update(shash, nqn,
strlen(nqn));
0f7847d23405a2 Hannes Reinecke 2021-09-10 267 if (ret < 0)
0f7847d23405a2 Hannes Reinecke 2021-09-10 268 goto out_free_shash;
0f7847d23405a2 Hannes Reinecke 2021-09-10 269 ret = crypto_shash_update(shash,
"NVMe-over-Fabrics", 17);
0f7847d23405a2 Hannes Reinecke 2021-09-10 270 if (ret < 0)
0f7847d23405a2 Hannes Reinecke 2021-09-10 271 goto out_free_shash;
0f7847d23405a2 Hannes Reinecke 2021-09-10 272 ret = crypto_shash_final(shash,
transformed_key);
0f7847d23405a2 Hannes Reinecke 2021-09-10 273 out_free_shash:
0f7847d23405a2 Hannes Reinecke 2021-09-10 274 kfree(shash);
0f7847d23405a2 Hannes Reinecke 2021-09-10 275 crypto_free_shash(key_tfm);
0f7847d23405a2 Hannes Reinecke 2021-09-10 276 if (ret < 0) {
0f7847d23405a2 Hannes Reinecke 2021-09-10 277 kfree_sensitive(transformed_key);
0f7847d23405a2 Hannes Reinecke 2021-09-10 278 return ERR_PTR(ret);
0f7847d23405a2 Hannes Reinecke 2021-09-10 279 }
0f7847d23405a2 Hannes Reinecke 2021-09-10 280 return transformed_key;
0f7847d23405a2 Hannes Reinecke 2021-09-10 281 }
0f7847d23405a2 Hannes Reinecke 2021-09-10 282
EXPORT_SYMBOL_GPL(nvme_auth_transform_key);
0f7847d23405a2 Hannes Reinecke 2021-09-10 283
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org