[bug report] rxrpc: Implement an in-kernel rxperf server for testing purposes
Dan Carpenter
error27 at gmail.com
Wed Dec 7 06:19:27 PST 2022
Hello David Howells,
The patch 75bfdbf2fca3: "rxrpc: Implement an in-kernel rxperf server
for testing purposes" from Nov 3, 2022, leads to the following Smatch
static checker warning:
net/rxrpc/rxperf.c:337 rxperf_deliver_to_call()
error: uninitialized symbol 'ret'.
net/rxrpc/rxperf.c
273 static void rxperf_deliver_to_call(struct work_struct *work)
274 {
275 struct rxperf_call *call = container_of(work, struct rxperf_call, work);
276 enum rxperf_call_state state;
277 u32 abort_code, remote_abort = 0;
278 int ret;
279
280 if (call->state == RXPERF_CALL_COMPLETE)
281 return;
282
283 while (state = call->state,
284 state == RXPERF_CALL_SV_AWAIT_PARAMS ||
285 state == RXPERF_CALL_SV_AWAIT_REQUEST ||
286 state == RXPERF_CALL_SV_AWAIT_ACK
287 ) {
288 if (state == RXPERF_CALL_SV_AWAIT_ACK) {
289 if (!rxrpc_kernel_check_life(rxperf_socket, call->rxcall))
290 goto call_complete;
Is it possible to hit this goto on the first iteration through the loop?
Otherwise this is "ret == 0" and it feels like maybe it should be an
error code.
291 return;
292 }
293
294 ret = call->deliver(call);
295 if (ret == 0)
296 ret = rxperf_process_call(call);
297
298 switch (ret) {
299 case 0:
300 continue;
301 case -EINPROGRESS:
302 case -EAGAIN:
303 return;
304 case -ECONNABORTED:
305 rxperf_log_error(call, call->abort_code);
306 goto call_complete;
307 case -EOPNOTSUPP:
308 abort_code = RXGEN_OPCODE;
309 rxrpc_kernel_abort_call(rxperf_socket, call->rxcall,
310 abort_code, ret, "GOP");
311 goto call_complete;
312 case -ENOTSUPP:
313 abort_code = RX_USER_ABORT;
314 rxrpc_kernel_abort_call(rxperf_socket, call->rxcall,
315 abort_code, ret, "GUA");
316 goto call_complete;
317 case -EIO:
318 pr_err("Call %u in bad state %u\n",
319 call->debug_id, call->state);
320 fallthrough;
321 case -ENODATA:
322 case -EBADMSG:
323 case -EMSGSIZE:
324 case -ENOMEM:
325 case -EFAULT:
326 rxrpc_kernel_abort_call(rxperf_socket, call->rxcall,
327 RXGEN_SS_UNMARSHAL, ret, "GUM");
328 goto call_complete;
329 default:
330 rxrpc_kernel_abort_call(rxperf_socket, call->rxcall,
331 RX_CALL_DEAD, ret, "GER");
332 goto call_complete;
333 }
334 }
335
336 call_complete:
--> 337 rxperf_set_call_complete(call, ret, remote_abort);
338 /* The call may have been requeued */
339 rxrpc_kernel_end_call(rxperf_socket, call->rxcall);
340 cancel_work(&call->work);
341 kfree(call);
342 }
regards,
dan carpenter
More information about the linux-afs
mailing list