lkml.org 
[lkml]   [2021]   [Jul]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
Subject[hare-scsi-devel:auth.v2 6/12] drivers/nvme/host/auth.c:40:5: warning: no previous prototype for 'nvme_auth_send'
tree:   https://git.kernel.org/pub/scm/linux/kernel/git/hare/scsi-devel.git auth.v2
head: 9107ea4a3526c6801b38b7a2345b7372278a35ba
commit: 723befd959651e629874f9ce9f4a322c4dbe008b [6/12] nvme: Implement In-Band authentication
config: x86_64-allyesconfig (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
reproduce (this is a W=1 build):
# https://git.kernel.org/pub/scm/linux/kernel/git/hare/scsi-devel.git/commit/?id=723befd959651e629874f9ce9f4a322c4dbe008b
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.v2
git checkout 723befd959651e629874f9ce9f4a322c4dbe008b
# save the attached .config to linux build tree
make W=1 ARCH=x86_64

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:40:5: warning: no previous prototype for 'nvme_auth_send' [-Wmissing-prototypes]
40 | int nvme_auth_send(struct nvme_ctrl *ctrl, int qid, void *data, size_t tl)
| ^~~~~~~~~~~~~~
>> drivers/nvme/host/auth.c:64:5: warning: no previous prototype for 'nvme_auth_receive' [-Wmissing-prototypes]
64 | int nvme_auth_receive(struct nvme_ctrl *ctrl, int qid, void *buf, size_t al,
| ^~~~~~~~~~~~~~~~~
>> drivers/nvme/host/auth.c:117:5: warning: no previous prototype for 'nvme_auth_dhchap_negotiate' [-Wmissing-prototypes]
117 | int nvme_auth_dhchap_negotiate(struct nvme_ctrl *ctrl,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
>> drivers/nvme/host/auth.c:144:5: warning: no previous prototype for 'nvme_auth_dhchap_challenge' [-Wmissing-prototypes]
144 | int nvme_auth_dhchap_challenge(struct nvme_ctrl *ctrl,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
>> drivers/nvme/host/auth.c:214:5: warning: no previous prototype for 'nvme_auth_dhchap_reply' [-Wmissing-prototypes]
214 | int nvme_auth_dhchap_reply(struct nvme_ctrl *ctrl,
| ^~~~~~~~~~~~~~~~~~~~~~
>> drivers/nvme/host/auth.c:257:5: warning: no previous prototype for 'nvme_auth_dhchap_success1' [-Wmissing-prototypes]
257 | int nvme_auth_dhchap_success1(struct nvme_ctrl *ctrl,
| ^~~~~~~~~~~~~~~~~~~~~~~~~
>> drivers/nvme/host/auth.c:302:5: warning: no previous prototype for 'nvme_auth_dhchap_success2' [-Wmissing-prototypes]
302 | int nvme_auth_dhchap_success2(struct nvme_ctrl *ctrl,
| ^~~~~~~~~~~~~~~~~~~~~~~~~
>> drivers/nvme/host/auth.c:317:5: warning: no previous prototype for 'nvme_auth_dhchap_failure2' [-Wmissing-prototypes]
317 | int nvme_auth_dhchap_failure2(struct nvme_ctrl *ctrl,
| ^~~~~~~~~~~~~~~~~~~~~~~~~
>> drivers/nvme/host/auth.c:334:5: warning: no previous prototype for 'nvme_auth_select_hash' [-Wmissing-prototypes]
334 | int nvme_auth_select_hash(struct nvme_ctrl *ctrl,
| ^~~~~~~~~~~~~~~~~~~~~
>> drivers/nvme/host/auth.c:385:5: warning: no previous prototype for 'nvme_auth_dhchap_host_response' [-Wmissing-prototypes]
385 | int nvme_auth_dhchap_host_response(struct nvme_ctrl *ctrl,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> drivers/nvme/host/auth.c:432:5: warning: no previous prototype for 'nvme_auth_dhchap_controller_response' [-Wmissing-prototypes]
432 | int nvme_auth_dhchap_controller_response(struct nvme_ctrl *ctrl,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> drivers/nvme/host/auth.c:485:5: warning: no previous prototype for 'nvme_auth_generate_key' [-Wmissing-prototypes]
485 | int nvme_auth_generate_key(struct nvme_ctrl *ctrl,
| ^~~~~~~~~~~~~~~~~~~~~~


vim +/nvme_auth_send +40 drivers/nvme/host/auth.c

39
> 40 int nvme_auth_send(struct nvme_ctrl *ctrl, int qid, void *data, size_t tl)
41 {
42 struct nvme_command cmd = {};
43 blk_mq_req_flags_t flags = qid == NVME_QID_ANY ?
44 0 : BLK_MQ_REQ_NOWAIT | BLK_MQ_REQ_RESERVED;
45 struct request_queue *q = qid == NVME_QID_ANY ?
46 ctrl->fabrics_q : ctrl->connect_q;
47 int ret;
48
49 cmd.auth_send.opcode = nvme_fabrics_command;
50 cmd.auth_send.fctype = nvme_fabrics_type_auth_send;
51 cmd.auth_send.secp = NVME_AUTH_DHCHAP_PROTOCOL_IDENTIFIER;
52 cmd.auth_send.spsp0 = 0x01;
53 cmd.auth_send.spsp1 = 0x01;
54 cmd.auth_send.tl = tl;
55
56 ret = __nvme_submit_sync_cmd(q, &cmd, NULL, data, tl, 0, qid,
57 0, flags);
58 if (ret)
59 dev_dbg(ctrl->device,
60 "%s: qid %d error %d\n", __func__, qid, ret);
61 return ret;
62 }
63
> 64 int nvme_auth_receive(struct nvme_ctrl *ctrl, int qid, void *buf, size_t al,
65 u16 transaction, u8 expected_msg )
66 {
67 struct nvme_command cmd = {};
68 struct nvmf_auth_dhchap_failure_data *data = buf;
69 blk_mq_req_flags_t flags = qid == NVME_QID_ANY ?
70 0 : BLK_MQ_REQ_NOWAIT | BLK_MQ_REQ_RESERVED;
71 struct request_queue *q = qid == NVME_QID_ANY ?
72 ctrl->fabrics_q : ctrl->connect_q;
73 int ret;
74
75 cmd.auth_receive.opcode = nvme_fabrics_command;
76 cmd.auth_receive.fctype = nvme_fabrics_type_auth_receive;
77 cmd.auth_receive.secp = NVME_AUTH_DHCHAP_PROTOCOL_IDENTIFIER;
78 cmd.auth_receive.spsp0 = 0x01;
79 cmd.auth_receive.spsp1 = 0x01;
80 cmd.auth_receive.al = al;
81
82 ret = __nvme_submit_sync_cmd(q, &cmd, NULL, buf, al, 0, qid,
83 0, flags);
84 if (ret > 0) {
85 dev_dbg(ctrl->device, "%s: qid %d nvme status %x\n",
86 __func__, qid, ret);
87 ret = -EIO;
88 }
89 if (ret < 0) {
90 dev_dbg(ctrl->device, "%s: qid %d error %d\n",
91 __func__, qid, ret);
92 return ret;
93 }
94 dev_dbg(ctrl->device, "%s: qid %d auth_type %d auth_id %x\n",
95 __func__, qid, data->auth_type, data->auth_id);
96 if (data->auth_type == NVME_AUTH_COMMON_MESSAGES &&
97 data->auth_id == NVME_AUTH_DHCHAP_MESSAGE_FAILURE1) {
98 return data->reason_code_explanation;
99 }
100 if (data->auth_type != NVME_AUTH_DHCHAP_MESSAGES ||
101 data->auth_id != expected_msg) {
102 dev_warn(ctrl->device,
103 "%s: qid %d invalid message type %02x/%02x\n",
104 __func__, qid, data->auth_type, data->auth_id);
105 return NVME_AUTH_DHCHAP_FAILURE_INVALID_PAYLOAD;
106 }
107 if (le16_to_cpu(data->t_id) != transaction) {
108 dev_warn(ctrl->device,
109 "%s: qid %d invalid transaction ID %d\n",
110 __func__, qid, le16_to_cpu(data->t_id));
111 return NVME_AUTH_DHCHAP_FAILURE_INVALID_PAYLOAD;
112 }
113
114 return 0;
115 }
116
> 117 int nvme_auth_dhchap_negotiate(struct nvme_ctrl *ctrl,
118 struct nvme_dhchap_context *chap,
119 void *buf, size_t buf_size)
120 {
121 struct nvmf_auth_dhchap_negotiate_data *data = buf;
122 size_t size = sizeof(*data) + sizeof(union nvmf_auth_protocol);
123
124 if (buf_size < size)
125 return -EINVAL;
126
127 memset((u8 *)buf, 0, size);
128 data->auth_type = NVME_AUTH_COMMON_MESSAGES;
129 data->auth_id = NVME_AUTH_DHCHAP_MESSAGE_NEGOTIATE;
130 data->t_id = cpu_to_le16(chap->transaction);
131 data->sc_c = 0; /* No secure channel concatenation */
132 data->napd = 1;
133 data->auth_protocol[0].dhchap.authid = NVME_AUTH_DHCHAP_AUTH_ID;
134 data->auth_protocol[0].dhchap.halen = 3;
135 data->auth_protocol[0].dhchap.dhlen = 1;
136 data->auth_protocol[0].dhchap.idlist[0] = NVME_AUTH_DHCHAP_HASH_SHA256;
137 data->auth_protocol[0].dhchap.idlist[1] = NVME_AUTH_DHCHAP_HASH_SHA384;
138 data->auth_protocol[0].dhchap.idlist[2] = NVME_AUTH_DHCHAP_HASH_SHA512;
139 data->auth_protocol[0].dhchap.idlist[3] = NVME_AUTH_DHCHAP_DHGROUP_NULL;
140
141 return size;
142 }
143
> 144 int nvme_auth_dhchap_challenge(struct nvme_ctrl *ctrl,
145 struct nvme_dhchap_context *chap,
146 void *buf, size_t buf_size)
147 {
148 struct nvmf_auth_dhchap_challenge_data *data = buf;
149 size_t size = sizeof(*data) + data->hl + data->dhvlen;
150 const char *gid_name;
151
152 if (buf_size < size) {
153 chap->status = NVME_AUTH_DHCHAP_FAILURE_INVALID_PAYLOAD;
154 return -ENOMSG;
155 }
156
157 if (data->hashid != NVME_AUTH_DHCHAP_HASH_SHA256 &&
158 data->hashid != NVME_AUTH_DHCHAP_HASH_SHA384 &&
159 data->hashid != NVME_AUTH_DHCHAP_HASH_SHA512) {
160 dev_warn(ctrl->device,
161 "qid %d: DH-HMAC-CHAP: invalid HASH ID %d\n",
162 chap->qid, data->hashid);
163 chap->status = NVME_AUTH_DHCHAP_FAILURE_HASH_UNUSABLE;
164 return -EPROTO;
165 }
166 switch (data->dhgid) {
167 case NVME_AUTH_DHCHAP_DHGROUP_NULL:
168 gid_name = "null";
169 break;
170 default:
171 gid_name = NULL;
172 break;
173 }
174 if (!gid_name) {
175 dev_warn(ctrl->device,
176 "qid %d: DH-HMAC-CHAP: invalid DH group id %d\n",
177 chap->qid, data->dhgid);
178 chap->status = NVME_AUTH_DHCHAP_FAILURE_DHGROUP_UNUSABLE;
179 return -EPROTO;
180 }
181 if (data->dhgid != NVME_AUTH_DHCHAP_DHGROUP_NULL) {
182 chap->status = NVME_AUTH_DHCHAP_FAILURE_DHGROUP_UNUSABLE;
183 return -EPROTO;
184 }
185 if (data->dhgid == NVME_AUTH_DHCHAP_DHGROUP_NULL && data->dhvlen != 0) {
186 dev_warn(ctrl->device,
187 "qid %d: DH-HMAC-CHAP: invalid DH value for NULL DH\n",
188 chap->qid);
189 chap->status = NVME_AUTH_DHCHAP_FAILURE_DHGROUP_UNUSABLE;
190 return -EPROTO;
191 }
192 dev_dbg(ctrl->device, "%s: qid %d requested hash id %d\n",
193 __func__, chap->qid, data->hashid);
194 chap->hash_id = data->hashid;
195 if ((data->hashid == NVME_AUTH_DHCHAP_HASH_SHA256 &&
196 data->hl != 32) ||
197 (data->hashid == NVME_AUTH_DHCHAP_HASH_SHA384 &&
198 data->hl != 48) ||
199 (data->hashid == NVME_AUTH_DHCHAP_HASH_SHA512 &&
200 data->hl != 64)) {
201 dev_warn(ctrl->device,
202 "qid %d: DH-HMAC-CHAP: invalid hash length\n",
203 chap->qid);
204 chap->status = NVME_AUTH_DHCHAP_FAILURE_HASH_UNUSABLE;
205 return -EPROTO;
206 }
207 chap->hash_len = data->hl;
208 chap->s1 = le32_to_cpu(data->seqnum);
209 memcpy(chap->c1, data->cval, chap->hash_len);
210
211 return 0;
212 }
213
> 214 int nvme_auth_dhchap_reply(struct nvme_ctrl *ctrl,
215 struct nvme_dhchap_context *chap,
216 void *buf, size_t buf_size)
217 {
218 struct nvmf_auth_dhchap_reply_data *data = buf;
219 size_t size = sizeof(*data);
220
221 size += 2 * chap->hash_len;
222 if (ctrl->opts->dhchap_auth) {
223 get_random_bytes(chap->c2, chap->hash_len);
224 chap->s2 = nvme_dhchap_seqnum++;
225 } else
226 memset(chap->c2, 0, chap->hash_len);
227
228 if (chap->host_key_len)
229 size += chap->host_key_len;
230
231 if (buf_size < size)
232 return -EINVAL;
233
234 memset(buf, 0, size);
235 data->auth_type = NVME_AUTH_DHCHAP_MESSAGES;
236 data->auth_id = NVME_AUTH_DHCHAP_MESSAGE_REPLY;
237 data->t_id = cpu_to_le16(chap->transaction);
238 data->hl = chap->hash_len;
239 data->dhvlen = chap->host_key_len;
240 data->seqnum = cpu_to_le32(chap->s2);
241 memcpy(data->rval, chap->response, chap->hash_len);
242 if (ctrl->opts->dhchap_auth) {
243 dev_dbg(ctrl->device, "%s: qid %d ctrl challenge %*ph\n",
244 __func__, chap->qid,
245 chap->hash_len, chap->c2);
246 data->cvalid = 1;
247 memcpy(data->rval + chap->hash_len, chap->c2,
248 chap->hash_len);
249 }
250 if (chap->host_key_len)
251 memcpy(data->rval + 2 * chap->hash_len, chap->host_key,
252 chap->host_key_len);
253
254 return size;
255 }
256

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
[unhandled content-type:application/gzip]
\
 
 \ /
  Last update: 2021-07-12 22:03    [W:0.039 / U:0.520 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site