* [hare-scsi-devel:auth 4/29] drivers/nvme/host/auth.c:38:5: warning: no previous prototype for 'nvme_auth_send'
@ 2021-03-26 19:20 kernel test robot
0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2021-03-26 19:20 UTC (permalink / raw)
To: kbuild-all
[-- Attachment #1: Type: text/plain, Size: 13251 bytes --]
tree: https://git.kernel.org/pub/scm/linux/kernel/git/hare/scsi-devel.git auth
head: 5efb97c6cb62d806bb13ed6032ee342f8e74ae43
commit: a3a5e2080109c329c0bf7b0fbee3fd9eba6ef545 [4/29] nvme: Implement In-Band authentication
config: xtensa-allyesconfig (attached as .config)
compiler: xtensa-linux-gcc (GCC) 9.3.0
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
# https://git.kernel.org/pub/scm/linux/kernel/git/hare/scsi-devel.git/commit/?id=a3a5e2080109c329c0bf7b0fbee3fd9eba6ef545
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
git checkout a3a5e2080109c329c0bf7b0fbee3fd9eba6ef545
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=xtensa
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
All warnings (new ones prefixed by >>):
>> drivers/nvme/host/auth.c:38:5: warning: no previous prototype for 'nvme_auth_send' [-Wmissing-prototypes]
38 | int nvme_auth_send(struct nvme_ctrl *ctrl, int qid, void *data, size_t tl)
| ^~~~~~~~~~~~~~
>> drivers/nvme/host/auth.c:62:5: warning: no previous prototype for 'nvme_auth_receive' [-Wmissing-prototypes]
62 | int nvme_auth_receive(struct nvme_ctrl *ctrl, int qid, void *buf, size_t al,
| ^~~~~~~~~~~~~~~~~
>> drivers/nvme/host/auth.c:115:5: warning: no previous prototype for 'nvme_auth_dhchap_negotiate' [-Wmissing-prototypes]
115 | int nvme_auth_dhchap_negotiate(struct nvme_ctrl *ctrl,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
>> drivers/nvme/host/auth.c:142:5: warning: no previous prototype for 'nvme_auth_dhchap_challenge' [-Wmissing-prototypes]
142 | int nvme_auth_dhchap_challenge(struct nvme_ctrl *ctrl,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
>> drivers/nvme/host/auth.c:220:5: warning: no previous prototype for 'nvme_auth_dhchap_reply' [-Wmissing-prototypes]
220 | int nvme_auth_dhchap_reply(struct nvme_ctrl *ctrl,
| ^~~~~~~~~~~~~~~~~~~~~~
>> drivers/nvme/host/auth.c:264:5: warning: no previous prototype for 'nvme_auth_dhchap_success1' [-Wmissing-prototypes]
264 | int nvme_auth_dhchap_success1(struct nvme_ctrl *ctrl,
| ^~~~~~~~~~~~~~~~~~~~~~~~~
>> drivers/nvme/host/auth.c:309:5: warning: no previous prototype for 'nvme_auth_dhchap_success2' [-Wmissing-prototypes]
309 | int nvme_auth_dhchap_success2(struct nvme_ctrl *ctrl,
| ^~~~~~~~~~~~~~~~~~~~~~~~~
>> drivers/nvme/host/auth.c:324:5: warning: no previous prototype for 'nvme_auth_dhchap_failure2' [-Wmissing-prototypes]
324 | int nvme_auth_dhchap_failure2(struct nvme_ctrl *ctrl,
| ^~~~~~~~~~~~~~~~~~~~~~~~~
>> drivers/nvme/host/auth.c:341:5: warning: no previous prototype for 'nvme_auth_select_hash' [-Wmissing-prototypes]
341 | int nvme_auth_select_hash(struct nvme_ctrl *ctrl,
| ^~~~~~~~~~~~~~~~~~~~~
>> drivers/nvme/host/auth.c:390:5: warning: no previous prototype for 'nvme_auth_dhchap_host_response' [-Wmissing-prototypes]
390 | int nvme_auth_dhchap_host_response(struct nvme_ctrl *ctrl,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> drivers/nvme/host/auth.c:437:5: warning: no previous prototype for 'nvme_auth_dhchap_controller_response' [-Wmissing-prototypes]
437 | int nvme_auth_dhchap_controller_response(struct nvme_ctrl *ctrl,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> drivers/nvme/host/auth.c:490:5: warning: no previous prototype for 'nvme_auth_generate_key' [-Wmissing-prototypes]
490 | int nvme_auth_generate_key(struct nvme_ctrl *ctrl,
| ^~~~~~~~~~~~~~~~~~~~~~
>> drivers/nvme/host/auth.c:525:5: warning: no previous prototype for 'nvme_auth_dhchap_exponential' [-Wmissing-prototypes]
525 | int nvme_auth_dhchap_exponential(struct nvme_ctrl *ctrl,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
vim +/nvme_auth_send +38 drivers/nvme/host/auth.c
37
> 38 int nvme_auth_send(struct nvme_ctrl *ctrl, int qid, void *data, size_t tl)
39 {
40 struct nvme_command cmd = {};
41 blk_mq_req_flags_t flags = qid == NVME_QID_ANY ?
42 0 : BLK_MQ_REQ_NOWAIT | BLK_MQ_REQ_RESERVED;
43 struct request_queue *q = qid == NVME_QID_ANY ?
44 ctrl->fabrics_q : ctrl->connect_q;
45 int ret;
46
47 cmd.auth_send.opcode = nvme_fabrics_command;
48 cmd.auth_send.fctype = nvme_fabrics_type_auth_send;
49 cmd.auth_send.secp = NVME_AUTH_DHCHAP_PROTOCOL_IDENTIFIER;
50 cmd.auth_send.spsp0 = 0x01;
51 cmd.auth_send.spsp1 = 0x01;
52 cmd.auth_send.tl = tl;
53
54 ret = __nvme_submit_sync_cmd(q, &cmd, NULL, data, tl, 0, qid,
55 0, flags, false);
56 if (ret)
57 dev_dbg(ctrl->device,
58 "%s: qid %d error %d\n", __func__, qid, ret);
59 return ret;
60 }
61
> 62 int nvme_auth_receive(struct nvme_ctrl *ctrl, int qid, void *buf, size_t al,
63 u16 transaction, u8 expected_msg )
64 {
65 struct nvme_command cmd = {};
66 struct nvmf_auth_dhchap_failure_data *data = buf;
67 blk_mq_req_flags_t flags = qid == NVME_QID_ANY ?
68 0 : BLK_MQ_REQ_NOWAIT | BLK_MQ_REQ_RESERVED;
69 struct request_queue *q = qid == NVME_QID_ANY ?
70 ctrl->fabrics_q : ctrl->connect_q;
71 int ret;
72
73 cmd.auth_receive.opcode = nvme_fabrics_command;
74 cmd.auth_receive.fctype = nvme_fabrics_type_auth_receive;
75 cmd.auth_receive.secp = NVME_AUTH_DHCHAP_PROTOCOL_IDENTIFIER;
76 cmd.auth_receive.spsp0 = 0x01;
77 cmd.auth_receive.spsp1 = 0x01;
78 cmd.auth_receive.al = al;
79
80 ret = __nvme_submit_sync_cmd(q, &cmd, NULL, buf, al, 0, qid,
81 0, flags, false);
82 if (ret > 0) {
83 dev_dbg(ctrl->device, "%s: qid %d nvme status %x\n",
84 __func__, qid, ret);
85 ret = -EIO;
86 }
87 if (ret < 0) {
88 dev_dbg(ctrl->device, "%s: qid %d error %d\n",
89 __func__, qid, ret);
90 return ret;
91 }
92 dev_dbg(ctrl->device, "%s: qid %d auth_type %d auth_id %x\n",
93 __func__, qid, data->auth_type, data->auth_id);
94 if (data->auth_type == NVME_AUTH_COMMON_MESSAGES &&
95 data->auth_id == NVME_AUTH_DHCHAP_MESSAGE_FAILURE1) {
96 return data->reason_code_explanation;
97 }
98 if (data->auth_type != NVME_AUTH_DHCHAP_MESSAGES ||
99 data->auth_id != expected_msg) {
100 dev_warn(ctrl->device,
101 "%s: qid %d invalid message type %02x/%02x\n",
102 __func__, qid, data->auth_type, data->auth_id);
103 return NVME_AUTH_DHCHAP_FAILURE_INVALID_PAYLOAD;
104 }
105 if (le16_to_cpu(data->t_id) != transaction) {
106 dev_warn(ctrl->device,
107 "%s: qid %d invalid transaction ID %d\n",
108 __func__, qid, le16_to_cpu(data->t_id));
109 return NVME_AUTH_DHCHAP_FAILURE_INVALID_PAYLOAD;
110 }
111
112 return 0;
113 }
114
> 115 int nvme_auth_dhchap_negotiate(struct nvme_ctrl *ctrl,
116 struct nvme_dhchap_context *chap,
117 void *buf, size_t buf_size)
118 {
119 struct nvmf_auth_dhchap_negotiate_data *data = buf;
120 size_t size = sizeof(*data) + sizeof(union nvmf_auth_protocol);
121
122 if (buf_size < size)
123 return -EINVAL;
124
125 memset((u8 *)buf, 0, size);
126 data->auth_type = NVME_AUTH_COMMON_MESSAGES;
127 data->auth_id = NVME_AUTH_DHCHAP_MESSAGE_NEGOTIATE;
128 data->t_id = cpu_to_le16(chap->transaction);
129 data->sc_c = 0; /* No secure channel concatenation */
130 data->napd = 1;
131 data->auth_protocol[0].dhchap.authid = NVME_AUTH_DHCHAP_AUTH_ID;
132 data->auth_protocol[0].dhchap.halen = 3;
133 data->auth_protocol[0].dhchap.dhlen = 1;
134 data->auth_protocol[0].dhchap.idlist[0] = NVME_AUTH_DHCHAP_HASH_SHA256;
135 data->auth_protocol[0].dhchap.idlist[1] = NVME_AUTH_DHCHAP_HASH_SHA384;
136 data->auth_protocol[0].dhchap.idlist[2] = NVME_AUTH_DHCHAP_HASH_SHA512;
137 data->auth_protocol[0].dhchap.idlist[3] = NVME_AUTH_DHCHAP_DHGROUP_NULL;
138
139 return size;
140 }
141
> 142 int nvme_auth_dhchap_challenge(struct nvme_ctrl *ctrl,
143 struct nvme_dhchap_context *chap,
144 void *buf, size_t buf_size)
145 {
146 struct nvmf_auth_dhchap_challenge_data *data = buf;
147 size_t size = sizeof(*data) + data->hl + data->dhvlen;
148 const char *gid_name;
149
150 if (buf_size < size) {
151 chap->status = NVME_AUTH_DHCHAP_FAILURE_INVALID_PAYLOAD;
152 return -ENOMSG;
153 }
154
155 if (data->hashid != NVME_AUTH_DHCHAP_HASH_SHA256 &&
156 data->hashid != NVME_AUTH_DHCHAP_HASH_SHA384 &&
157 data->hashid != NVME_AUTH_DHCHAP_HASH_SHA512) {
158 dev_warn(ctrl->device,
159 "qid %d: DH-HMAC-CHAP: invalid HASH ID %d\n",
160 chap->qid, data->hashid);
161 chap->status = NVME_AUTH_DHCHAP_FAILURE_HASH_UNUSABLE;
162 return -EPROTO;
163 }
164 switch (data->dhgid) {
165 case NVME_AUTH_DHCHAP_DHGROUP_NULL:
166 gid_name = "null";
167 break;
168 default:
169 gid_name = NULL;
170 break;
171 }
172 if (!gid_name) {
173 dev_warn(ctrl->device,
174 "qid %d: DH-HMAC-CHAP: invalid DH group id %d\n",
175 chap->qid, data->dhgid);
176 chap->status = NVME_AUTH_DHCHAP_FAILURE_DHGROUP_UNUSABLE;
177 return -EPROTO;
178 }
179 if (data->dhgid != NVME_AUTH_DHCHAP_DHGROUP_NULL) {
180 chap->status = NVME_AUTH_DHCHAP_FAILURE_DHGROUP_UNUSABLE;
181 return -EPROTO;
182 }
183 if (data->dhgid == NVME_AUTH_DHCHAP_DHGROUP_NULL && data->dhvlen != 0) {
184 dev_warn(ctrl->device,
185 "qid %d: DH-HMAC-CHAP: invalid DH value for NULL DH\n",
186 chap->qid);
187 chap->status = NVME_AUTH_DHCHAP_FAILURE_DHGROUP_UNUSABLE;
188 return -EPROTO;
189 }
190 dev_dbg(ctrl->device, "%s: qid %d requested hash id %d\n",
191 __func__, chap->qid, data->hashid);
192 chap->hash_id = data->hashid;
193 if ((data->hashid == NVME_AUTH_DHCHAP_HASH_SHA256 &&
194 data->hl != 32) ||
195 (data->hashid == NVME_AUTH_DHCHAP_HASH_SHA384 &&
196 data->hl != 48) ||
197 (data->hashid == NVME_AUTH_DHCHAP_HASH_SHA512 &&
198 data->hl != 64)) {
199 dev_warn(ctrl->device,
200 "qid %d: DH-HMAC-CHAP: invalid hash length\n",
201 chap->qid);
202 chap->status = NVME_AUTH_DHCHAP_FAILURE_HASH_UNUSABLE;
203 return -EPROTO;
204 }
205 chap->hash_len = data->hl;
206 chap->seqnum = le32_to_cpu(data->seqnum);
207 memcpy(chap->challenge, data->cval, chap->hash_len);
208 if (data->dhvlen) {
209 chap->ctrl_key = kmalloc(data->dhvlen, GFP_KERNEL);
210 if (!chap->ctrl_key)
211 return -ENOMEM;
212 chap->ctrl_key_len = data->dhvlen;
213 memcpy(chap->ctrl_key, data->cval + chap->hash_len,
214 data->dhvlen);
215 }
216
217 return 0;
218 }
219
> 220 int nvme_auth_dhchap_reply(struct nvme_ctrl *ctrl,
221 struct nvme_dhchap_context *chap,
222 void *buf, size_t buf_size)
223 {
224 struct nvmf_auth_dhchap_reply_data *data = buf;
225 size_t size = sizeof(*data);
226
227 size += chap->hash_len;
228 if (ctrl->opts->dhchap_auth) {
229 get_random_bytes(chap->challenge, chap->hash_len);
230 size += chap->hash_len;
231 chap->seqnum = nvme_dhchap_seqnum++;
232 } else
233 memset(chap->challenge, 0, chap->hash_len);
234
235 if (chap->host_key_len)
236 size += chap->host_key_len;
237
238 if (buf_size < size)
239 return -EINVAL;
240
241 memset(buf, 0, size);
242 data->auth_type = NVME_AUTH_DHCHAP_MESSAGES;
243 data->auth_id = NVME_AUTH_DHCHAP_MESSAGE_REPLY;
244 data->t_id = cpu_to_le16(chap->transaction);
245 data->hl = chap->hash_len;
246 data->dhvlen = chap->host_key_len;
247 data->seqnum = cpu_to_le32(chap->seqnum);
248 memcpy(data->rval, chap->response, chap->hash_len);
249 if (ctrl->opts->dhchap_auth) {
250 dev_dbg(ctrl->device, "%s: qid %d ctrl challenge %*ph\n",
251 __func__, chap->qid,
252 chap->hash_len, chap->challenge);
253 data->cvalid = 1;
254 memcpy(data->rval + chap->hash_len, chap->challenge,
255 chap->hash_len);
256 }
257 if (chap->host_key_len)
258 memcpy(data->rval + 2 * chap->hash_len, chap->host_key,
259 chap->host_key_len);
260
261 return size;
262 }
263
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 67280 bytes --]
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2021-03-26 19:20 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-26 19:20 [hare-scsi-devel:auth 4/29] drivers/nvme/host/auth.c:38:5: warning: no previous prototype for 'nvme_auth_send' 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.