diff mbox

caif: remove unneeded null check in caif_connect()

Message ID 20100522204342.GV22515@bicker
State Accepted, archived
Delegated to: David Miller
Headers show

Commit Message

Dan Carpenter May 22, 2010, 8:43 p.m. UTC
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.

Signed-off-by: Dan Carpenter <error27@gmail.com>

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Sjur Brændeland May 24, 2010, 7:56 p.m. UTC | #1
Dan Carpenter <error27@gmail.com> wrote:
> 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.
>
> Signed-off-by: Dan Carpenter <error27@gmail.com>
Thanks Looks good,
Acked-by: Sjur Braendeland <sjur.brandeland@stericsson.com>
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
David Miller May 31, 2010, 7:32 a.m. UTC | #2
From: Sjur Brændeland <sjurbren@gmail.com>
Date: Mon, 24 May 2010 21:56:01 +0200

> Dan Carpenter <error27@gmail.com> wrote:
>> 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.
>>
>> Signed-off-by: Dan Carpenter <error27@gmail.com>
> Thanks Looks good,
> Acked-by: Sjur Braendeland <sjur.brandeland@stericsson.com>

Applied.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/net/caif/caif_socket.c b/net/caif/caif_socket.c
index c3a70c5..bd67bb3 100644
--- a/net/caif/caif_socket.c
+++ b/net/caif/caif_socket.c
@@ -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,