[<prev] [next>] [day] [month] [year] [list]
Message-ID: <202206281449.L1Gh7eYz-lkp@intel.com>
Date: Tue, 28 Jun 2022 14:38:12 +0800
From: kernel test robot <lkp@...el.com>
To: Hannes Reinecke <hare@...e.de>
Cc: llvm@...ts.linux.dev, kbuild-all@...ts.01.org,
linux-kernel@...r.kernel.org, Sagi Grimberg <sagi@...mberg.me>
Subject: [hare-scsi-devel:auth.v15 6/11] drivers/nvme/common/auth.c:59:31:
warning: address of array 'dhgroup_map[dhgroup_id].name' will always
evaluate to 'true'
tree: https://git.kernel.org/pub/scm/linux/kernel/git/hare/scsi-devel.git auth.v15
head: 2a3a7d0493841ac5944dc0ba861b53d1c2b28014
commit: e0c48505224ab6f6e86eea90b254ae202ecd0bb6 [6/11] nvme: Implement In-Band authentication
config: riscv-randconfig-c006-20220627 (https://download.01.org/0day-ci/archive/20220628/202206281449.L1Gh7eYz-lkp@intel.com/config)
compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project 016342e319fd31e41cf5ed16a6140a8ea2de74dd)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# install riscv cross compiling tool for clang build
# apt-get install binutils-riscv-linux-gnu
# https://git.kernel.org/pub/scm/linux/kernel/git/hare/scsi-devel.git/commit/?id=e0c48505224ab6f6e86eea90b254ae202ecd0bb6
git remote add hare-scsi-devel https://git.kernel.org/pub/scm/linux/kernel/git/hare/scsi-devel.git
git fetch --no-tags hare-scsi-devel auth.v15
git checkout e0c48505224ab6f6e86eea90b254ae202ecd0bb6
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=riscv SHELL=/bin/bash drivers/nvme/common/ drivers/nvme/target/
If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <lkp@...el.com>
All warnings (new ones prefixed by >>):
>> drivers/nvme/common/auth.c:59:31: warning: address of array 'dhgroup_map[dhgroup_id].name' will always evaluate to 'true' [-Wpointer-bool-conversion]
!dhgroup_map[dhgroup_id].name ||
~~~~~~~~~~~~~~~~~~~~~~~~~^~~~
>> drivers/nvme/common/auth.c:69:31: warning: address of array 'dhgroup_map[dhgroup_id].kpp' will always evaluate to 'true' [-Wpointer-bool-conversion]
!dhgroup_map[dhgroup_id].kpp ||
~~~~~~~~~~~~~~~~~~~~~~~~~^~~
>> drivers/nvme/common/auth.c:81:23: warning: address of array 'dhgroup_map[i].name' will always evaluate to 'true' [-Wpointer-bool-conversion]
if (!dhgroup_map[i].name ||
~~~~~~~~~~~~~~~~^~~~
>> drivers/nvme/common/auth.c:117:25: warning: address of array 'hash_map[hmac_id].hmac' will always evaluate to 'true' [-Wpointer-bool-conversion]
!hash_map[hmac_id].hmac ||
~~~~~~~~~~~~~~~~~~~^~~~
>> drivers/nvme/common/auth.c:127:25: warning: address of array 'hash_map[hmac_id].digest' will always evaluate to 'true' [-Wpointer-bool-conversion]
!hash_map[hmac_id].digest ||
~~~~~~~~~~~~~~~~~~~^~~~~~
>> drivers/nvme/common/auth.c:139:20: warning: address of array 'hash_map[i].hmac' will always evaluate to 'true' [-Wpointer-bool-conversion]
if (!hash_map[i].hmac || !strlen(hash_map[i].hmac))
~~~~~~~~~~~~~^~~~
drivers/nvme/common/auth.c:152:25: warning: address of array 'hash_map[hmac_id].hmac' will always evaluate to 'true' [-Wpointer-bool-conversion]
!hash_map[hmac_id].hmac ||
~~~~~~~~~~~~~~~~~~~^~~~
error: A dwo section may not contain relocations
error: A dwo section may not contain relocations
error: A dwo section may not contain relocations
error: A dwo section may not contain relocations
error: A dwo section may not contain relocations
error: A dwo section may not contain relocations
error: A dwo section may not contain relocations
error: A dwo section may not contain relocations
error: A dwo section may not contain relocations
error: A dwo section may not contain relocations
error: A dwo section may not contain relocations
error: A dwo section may not contain relocations
error: A dwo section may not contain relocations
error: A dwo section may not contain relocations
error: A dwo section may not contain relocations
error: A dwo section may not contain relocations
error: A dwo section may not contain relocations
error: A dwo section may not contain relocations
error: A dwo section may not contain relocations
fatal error: too many errors emitted, stopping now [-ferror-limit=]
7 warnings and 20 errors generated.
vim +59 drivers/nvme/common/auth.c
55
56 const char *nvme_auth_dhgroup_name(u8 dhgroup_id)
57 {
58 if ((dhgroup_id > ARRAY_SIZE(dhgroup_map)) ||
> 59 !dhgroup_map[dhgroup_id].name ||
60 !strlen(dhgroup_map[dhgroup_id].name))
61 return NULL;
62 return dhgroup_map[dhgroup_id].name;
63 }
64 EXPORT_SYMBOL_GPL(nvme_auth_dhgroup_name);
65
66 const char *nvme_auth_dhgroup_kpp(u8 dhgroup_id)
67 {
68 if ((dhgroup_id > ARRAY_SIZE(dhgroup_map)) ||
> 69 !dhgroup_map[dhgroup_id].kpp ||
70 !strlen(dhgroup_map[dhgroup_id].kpp))
71 return NULL;
72 return dhgroup_map[dhgroup_id].kpp;
73 }
74 EXPORT_SYMBOL_GPL(nvme_auth_dhgroup_kpp);
75
76 u8 nvme_auth_dhgroup_id(const char *dhgroup_name)
77 {
78 int i;
79
80 for (i = 0; i < ARRAY_SIZE(dhgroup_map); i++) {
> 81 if (!dhgroup_map[i].name ||
82 !strlen(dhgroup_map[i].name))
83 continue;
84 if (!strncmp(dhgroup_map[i].name, dhgroup_name,
85 strlen(dhgroup_map[i].name)))
86 return i;
87 }
88 return NVME_AUTH_DHGROUP_INVALID;
89 }
90 EXPORT_SYMBOL_GPL(nvme_auth_dhgroup_id);
91
92 static struct nvme_dhchap_hash_map {
93 int len;
94 const char hmac[15];
95 const char digest[8];
96 } hash_map[] = {
97 [NVME_AUTH_HASH_SHA256] = {
98 .len = 32,
99 .hmac = "hmac(sha256)",
100 .digest = "sha256",
101 },
102 [NVME_AUTH_HASH_SHA384] = {
103 .len = 48,
104 .hmac = "hmac(sha384)",
105 .digest = "sha384",
106 },
107 [NVME_AUTH_HASH_SHA512] = {
108 .len = 64,
109 .hmac = "hmac(sha512)",
110 .digest = "sha512",
111 },
112 };
113
114 const char *nvme_auth_hmac_name(u8 hmac_id)
115 {
116 if ((hmac_id > ARRAY_SIZE(hash_map)) ||
> 117 !hash_map[hmac_id].hmac ||
118 !strlen(hash_map[hmac_id].hmac))
119 return NULL;
120 return hash_map[hmac_id].hmac;
121 }
122 EXPORT_SYMBOL_GPL(nvme_auth_hmac_name);
123
124 const char *nvme_auth_digest_name(u8 hmac_id)
125 {
126 if ((hmac_id > ARRAY_SIZE(hash_map)) ||
> 127 !hash_map[hmac_id].digest ||
128 !strlen(hash_map[hmac_id].digest))
129 return NULL;
130 return hash_map[hmac_id].digest;
131 }
132 EXPORT_SYMBOL_GPL(nvme_auth_digest_name);
133
134 u8 nvme_auth_hmac_id(const char *hmac_name)
135 {
136 int i;
137
138 for (i = 0; i < ARRAY_SIZE(hash_map); i++) {
> 139 if (!hash_map[i].hmac || !strlen(hash_map[i].hmac))
140 continue;
141 if (!strncmp(hash_map[i].hmac, hmac_name,
142 strlen(hash_map[i].hmac)))
143 return i;
144 }
145 return NVME_AUTH_HASH_INVALID;
146 }
147 EXPORT_SYMBOL_GPL(nvme_auth_hmac_id);
148
--
0-DAY CI Kernel Test Service
https://01.org/lkp
Powered by blists - more mailing lists