[2.6.21 patch] net/sunrpc/svcsock.c: fix a check

From: Adrian Bunk
Date: Mon Mar 19 2007 - 05:33:56 EST


The return value of kernel_recvmsg() should be assigned to "err", not
compared with the random value of a never initialized "err"
(and the "< 0" check wrongly always returned false since == comparisons
never have a result < 0).

Spotted by the Coverity checker.

Signed-off-by: Adrian Bunk <bunk@xxxxxxxxx>

---
--- linux-2.6.21-rc3-mm2/net/sunrpc/svcsock.c.old 2007-03-19 09:44:40.000000000 +0100
+++ linux-2.6.21-rc3-mm2/net/sunrpc/svcsock.c 2007-03-19 09:45:18.000000000 +0100
@@ -779,8 +779,8 @@ svc_udp_recvfrom(struct svc_rqst *rqstp)
}

clear_bit(SK_DATA, &svsk->sk_flags);
- while ((err == kernel_recvmsg(svsk->sk_sock, &msg, NULL,
- 0, 0, MSG_PEEK | MSG_DONTWAIT)) < 0 ||
+ while ((err = kernel_recvmsg(svsk->sk_sock, &msg, NULL,
+ 0, 0, MSG_PEEK | MSG_DONTWAIT)) < 0 ||
(skb = skb_recv_datagram(svsk->sk_sk, 0, 1, &err)) == NULL) {
if (err == -EAGAIN) {
svc_sock_received(svsk);

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/