Skip to contentSkip to conversation

Remove unnecessary check in net/sunrpc/svcsock.c

PATCH Applied Eric Sesterhenn 2 participants 2 messages Sep 27, 2006 – Sep 28, 2006

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Remove unnecessary check in net/sunrpc/svcsock.c

hi,

coverity spotted this one as possible dereference in the dprintk(), but since there is only one caller of svc_create_socket(), which always passes a valid sin, we dont need this check.

net/sunrpc/svcsock.c renamed from net/sunrpc/svcsock.c.orig +6 -8
@@ -1393,14 +1393,12 @@ svc_create_socket(struct svc_serv *serv,
 	if ((error = sock_create_kern(PF_INET, type, protocol, &sock)) < 0)
 		return error;
 
-	if (sin != NULL) {
-		if (type == SOCK_STREAM)
-			sock->sk->sk_reuse = 1; /* allow address reuse */
-		error = kernel_bind(sock, (struct sockaddr *) sin,
-						sizeof(*sin));
-		if (error < 0)
-			goto bummer;
-	}
+	if (type == SOCK_STREAM)
+		sock->sk->sk_reuse = 1; /* allow address reuse */
+	error = kernel_bind(sock, (struct sockaddr *) sin,
+					sizeof(*sin));
+	if (error < 0)
+		goto bummer;
 
 	if (protocol == IPPROTO_TCP) {
 		if ((error = kernel_listen(sock, 64)) < 0)
maintainer Applied
#1 lore raw

From: Eric Sesterhenn <[email protected]>
Date: Wed, 27 Sep 2006 17:34:49 +0200

Quoted 5 lines

coverity spotted this one as possible dereference in the dprintk(), but since there is only one caller of svc_create_socket(), which always passes a valid sin, we dont need this check.

Applied, thanks Eric.