Skip to contentSkip to conversation

caif: remove unneeded null check in caif_connect()

PATCH Applied Dan Carpenter 3 participants 4 messages May 22, 2010 – May 31, 2010

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

PATCH 1/1 caif: remove unneeded null check in caif_connect()

We already dereferenced uaddr towards the start of the function when we checked that "uaddr->sa_family != AF_CAIF". Both the check here and the earlier check were added in bece7b2398d0: "caif: Rewritten socket implementation". Before that patch, we assumed that we recieved a valid pointer for uaddr, and based on that, I have removed this check.

net/caif/caif_socket.c +1 -2
index c3a70c5..bd67bb3 100644
@@ -890,8 +890,7 @@ static int caif_connect(struct socket *sock, struct sockaddr *uaddr,
 	sk_stream_kill_queues(&cf_sk->sk);
 
 	err = -EINVAL;
-	if (addr_len != sizeof(struct sockaddr_caif) ||
-		!uaddr)
+	if (addr_len != sizeof(struct sockaddr_caif))
 		goto out;
 
 	memcpy(&cf_sk->conn_req.sockaddr, uaddr,
Acked-by Sjur Braendeland on v1 1/1
#1 lore raw
Quoted 7 lines · Dan Carpenter

We already dereferenced uaddr towards the start of the function when we checked that "uaddr->sa_family != AF_CAIF".  Both the check here and the earlier check were added in bece7b2398d0: "caif: Rewritten socket implementation".  Before that patch, we assumed that we recieved a valid pointer for uaddr, and based on that, I have removed this check.

Thanks Looks good,

maintainer Applied
#2 lore raw

From: Sjur Brændeland <[email protected]>
Date: Mon, 24 May 2010 21:56:01 +0200

Quoted 10 lines
Quoted 7 lines · Dan Carpenter

We already dereferenced uaddr towards the start of the function when we checked that "uaddr->sa_family != AF_CAIF".  Both the check here and the earlier check were added in bece7b2398d0: "caif: Rewritten socket implementation".  Before that patch, we assumed that we recieved a valid pointer for uaddr, and based on that, I have removed this check.

Thanks Looks good,

Applied.

Acked-by Sjur Braendeland on v1 1/1
#3 lore raw
In reply to Dan Carpenter
Quoted 7 lines · Dan Carpenter

We already dereferenced uaddr towards the start of the function when we checked that "uaddr->sa_family != AF_CAIF".  Both the check here and the earlier check were added in bece7b2398d0: "caif: Rewritten socket implementation".  Before that patch, we assumed that we recieved a valid pointer for uaddr, and based on that, I have removed this check.

Thanks Looks good,