Skip to content

Commit cb57908

Browse files
Dan Carpenterchucklever
authored andcommitted
SUNRPC: fix ternary sign expansion bug in tracing
This code is supposed to pass negative "err" values for tracing but it passes positive values instead. The problem is that the trace_svcsock_tcp_send() function takes a long but "err" is an int and "sent" is a u32. The negative is first type promoted to u32 so it becomes a high positive then it is promoted to long and it stays positive. Fix this by casting "err" directly to long. Fixes: 998024d ("SUNRPC: Add more svcsock tracepoints") Signed-off-by: Dan Carpenter <[email protected]> Signed-off-by: Chuck Lever <[email protected]>
1 parent 76c50eb commit cb57908

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

net/sunrpc/svcsock.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1174,7 +1174,7 @@ static int svc_tcp_sendto(struct svc_rqst *rqstp)
11741174
tcp_sock_set_cork(svsk->sk_sk, true);
11751175
err = svc_tcp_sendmsg(svsk->sk_sock, xdr, marker, &sent);
11761176
xdr_free_bvec(xdr);
1177-
trace_svcsock_tcp_send(xprt, err < 0 ? err : sent);
1177+
trace_svcsock_tcp_send(xprt, err < 0 ? (long)err : sent);
11781178
if (err < 0 || sent != (xdr->len + sizeof(marker)))
11791179
goto out_close;
11801180
if (atomic_dec_and_test(&svsk->sk_sendqlen))

0 commit comments

Comments
 (0)