Skip to content

Commit 31d35a0

Browse files
dhowellsdavem330
authored andcommitted
rxrpc: Fix the return value of rxrpc_new_incoming_call()
Dan Carpenter sayeth[1]: The patch 5e6ef4f: "rxrpc: Make the I/O thread take over the call and local processor work" from Jan 23, 2020, leads to the following Smatch static checker warning: net/rxrpc/io_thread.c:283 rxrpc_input_packet() warn: bool is not less than zero. Fix this (for now) by changing rxrpc_new_incoming_call() to return an int with 0 or error code rather than bool. Note that the actual return value of rxrpc_input_packet() is currently ignored. I have a separate patch to clean that up. Fixes: 5e6ef4f ("rxrpc: Make the I/O thread take over the call and local processor work") Reported-by: Dan Carpenter <[email protected]> Signed-off-by: David Howells <[email protected]> cc: Marc Dionne <[email protected]> cc: [email protected] Link: http://lists.infradead.org/pipermail/linux-afs/2022-December/006123.html [1] Signed-off-by: David S. Miller <[email protected]>
1 parent 11e1706 commit 31d35a0

File tree

3 files changed

+14
-14
lines changed

3 files changed

+14
-14
lines changed

net/rxrpc/ar-internal.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -812,9 +812,9 @@ extern struct workqueue_struct *rxrpc_workqueue;
812812
*/
813813
int rxrpc_service_prealloc(struct rxrpc_sock *, gfp_t);
814814
void rxrpc_discard_prealloc(struct rxrpc_sock *);
815-
bool rxrpc_new_incoming_call(struct rxrpc_local *, struct rxrpc_peer *,
816-
struct rxrpc_connection *, struct sockaddr_rxrpc *,
817-
struct sk_buff *);
815+
int rxrpc_new_incoming_call(struct rxrpc_local *, struct rxrpc_peer *,
816+
struct rxrpc_connection *, struct sockaddr_rxrpc *,
817+
struct sk_buff *);
818818
void rxrpc_accept_incoming_calls(struct rxrpc_local *);
819819
int rxrpc_user_charge_accept(struct rxrpc_sock *, unsigned long);
820820

net/rxrpc/call_accept.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -326,11 +326,11 @@ static struct rxrpc_call *rxrpc_alloc_incoming_call(struct rxrpc_sock *rx,
326326
* If we want to report an error, we mark the skb with the packet type and
327327
* abort code and return false.
328328
*/
329-
bool rxrpc_new_incoming_call(struct rxrpc_local *local,
330-
struct rxrpc_peer *peer,
331-
struct rxrpc_connection *conn,
332-
struct sockaddr_rxrpc *peer_srx,
333-
struct sk_buff *skb)
329+
int rxrpc_new_incoming_call(struct rxrpc_local *local,
330+
struct rxrpc_peer *peer,
331+
struct rxrpc_connection *conn,
332+
struct sockaddr_rxrpc *peer_srx,
333+
struct sk_buff *skb)
334334
{
335335
const struct rxrpc_security *sec = NULL;
336336
struct rxrpc_skb_priv *sp = rxrpc_skb(skb);
@@ -342,7 +342,7 @@ bool rxrpc_new_incoming_call(struct rxrpc_local *local,
342342
/* Don't set up a call for anything other than the first DATA packet. */
343343
if (sp->hdr.seq != 1 ||
344344
sp->hdr.type != RXRPC_PACKET_TYPE_DATA)
345-
return true; /* Just discard */
345+
return 0; /* Just discard */
346346

347347
rcu_read_lock();
348348

@@ -413,7 +413,7 @@ bool rxrpc_new_incoming_call(struct rxrpc_local *local,
413413
_leave(" = %p{%d}", call, call->debug_id);
414414
rxrpc_input_call_event(call, skb);
415415
rxrpc_put_call(call, rxrpc_call_put_input);
416-
return true;
416+
return 0;
417417

418418
unsupported_service:
419419
trace_rxrpc_abort(0, "INV", sp->hdr.cid, sp->hdr.callNumber, sp->hdr.seq,
@@ -425,10 +425,10 @@ bool rxrpc_new_incoming_call(struct rxrpc_local *local,
425425
reject:
426426
rcu_read_unlock();
427427
_leave(" = f [%u]", skb->mark);
428-
return false;
428+
return -EPROTO;
429429
discard:
430430
rcu_read_unlock();
431-
return true;
431+
return 0;
432432
}
433433

434434
/*

net/rxrpc/io_thread.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@ static int rxrpc_input_packet(struct rxrpc_local *local, struct sk_buff **_skb)
292292
skb->mark = RXRPC_SKB_MARK_REJECT_ABORT;
293293
reject_packet:
294294
rxrpc_reject_packet(local, skb);
295-
return ret;
295+
return 0;
296296
}
297297

298298
/*
@@ -384,7 +384,7 @@ static int rxrpc_input_packet_on_conn(struct rxrpc_connection *conn,
384384
if (rxrpc_to_client(sp))
385385
goto bad_message;
386386
if (rxrpc_new_incoming_call(conn->local, conn->peer, conn,
387-
peer_srx, skb))
387+
peer_srx, skb) == 0)
388388
return 0;
389389
goto reject_packet;
390390
}

0 commit comments

Comments
 (0)