diff mbox

[v2] sctp: cleanup: remove duplicate assignment

Message ID 20100424171805.GO29093@bicker
State Awaiting Upstream, archived
Delegated to: David Miller
Headers show

Commit Message

Dan Carpenter April 24, 2010, 5:19 p.m. UTC
This assignment isn't needed because we did it earlier already.

Also another reason to delete the assignment is because it triggers a
Smatch warning about checking for NULL pointers after a dereference.

Reported-by: Vlad Yasevich <vladislav.yasevich@hp.com>
Signed-off-by: Dan Carpenter <error27@gmail.com>
---
Thanks Vlad.  I came so close to seeing that myself if only I had openned
my eyes a tiny bit more.  :P

--
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

Vlad Yasevich April 27, 2010, 2:32 p.m. UTC | #1
Dan Carpenter wrote:
> This assignment isn't needed because we did it earlier already.
> 
> Also another reason to delete the assignment is because it triggers a
> Smatch warning about checking for NULL pointers after a dereference.
> 
> Reported-by: Vlad Yasevich <vladislav.yasevich@hp.com>
> Signed-off-by: Dan Carpenter <error27@gmail.com>

Thanks.  I'll take this one.

-vlad

> ---
> Thanks Vlad.  I came so close to seeing that myself if only I had openned
> my eyes a tiny bit more.  :P
> 
> diff --git a/net/sctp/sm_make_chunk.c b/net/sctp/sm_make_chunk.c
> index 17cb400..33aed1c 100644
> --- a/net/sctp/sm_make_chunk.c
> +++ b/net/sctp/sm_make_chunk.c
> @@ -419,10 +419,17 @@ struct sctp_chunk *sctp_make_init_ack(const struct sctp_association *asoc,
>  	if (!retval)
>  		goto nomem_chunk;
>  
> -	/* Per the advice in RFC 2960 6.4, send this reply to
> -	 * the source of the INIT packet.
> +	/* RFC 2960 6.4 Multi-homed SCTP Endpoints
> +	 *
> +	 * An endpoint SHOULD transmit reply chunks (e.g., SACK,
> +	 * HEARTBEAT ACK, * etc.) to the same destination transport
> +	 * address from which it received the DATA or control chunk
> +	 * to which it is replying.
> +	 *
> +	 * [INIT ACK back to where the INIT came from.]
>  	 */
>  	retval->transport = chunk->transport;
> +
>  	retval->subh.init_hdr =
>  		sctp_addto_chunk(retval, sizeof(initack), &initack);
>  	retval->param_hdr.v = sctp_addto_chunk(retval, addrs_len, addrs.v);
> @@ -461,18 +468,6 @@ struct sctp_chunk *sctp_make_init_ack(const struct sctp_association *asoc,
>  	/* We need to remove the const qualifier at this point.  */
>  	retval->asoc = (struct sctp_association *) asoc;
>  
> -	/* RFC 2960 6.4 Multi-homed SCTP Endpoints
> -	 *
> -	 * An endpoint SHOULD transmit reply chunks (e.g., SACK,
> -	 * HEARTBEAT ACK, * etc.) to the same destination transport
> -	 * address from which it received the DATA or control chunk
> -	 * to which it is replying.
> -	 *
> -	 * [INIT ACK back to where the INIT came from.]
> -	 */
> -	if (chunk)
> -		retval->transport = chunk->transport;
> -
>  nomem_chunk:
>  	kfree(cookie);
>  nomem_cookie:
> --
> To unsubscribe from this list: send the line "unsubscribe linux-sctp" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 
--
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 April 27, 2010, 4:58 p.m. UTC | #2
From: Vlad Yasevich <vladislav.yasevich@hp.com>
Date: Tue, 27 Apr 2010 10:32:34 -0400

> 
> 
> Dan Carpenter wrote:
>> This assignment isn't needed because we did it earlier already.
>> 
>> Also another reason to delete the assignment is because it triggers a
>> Smatch warning about checking for NULL pointers after a dereference.
>> 
>> Reported-by: Vlad Yasevich <vladislav.yasevich@hp.com>
>> Signed-off-by: Dan Carpenter <error27@gmail.com>
> 
> Thanks.  I'll take this one.

And when will I get this from you? :-)
--
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
Vlad Yasevich April 27, 2010, 5:32 p.m. UTC | #3
David Miller wrote:
> From: Vlad Yasevich <vladislav.yasevich@hp.com>
> Date: Tue, 27 Apr 2010 10:32:34 -0400
> 
>>
>> Dan Carpenter wrote:
>>> This assignment isn't needed because we did it earlier already.
>>>
>>> Also another reason to delete the assignment is because it triggers a
>>> Smatch warning about checking for NULL pointers after a dereference.
>>>
>>> Reported-by: Vlad Yasevich <vladislav.yasevich@hp.com>
>>> Signed-off-by: Dan Carpenter <error27@gmail.com>
>> Thanks.  I'll take this one.
> 
> And when will I get this from you? :-)

By the end of the week.  I am trying to get all the testing finished. :)

-vlad

> --
> To unsubscribe from this list: send the line "unsubscribe linux-sctp" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 
--
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/sctp/sm_make_chunk.c b/net/sctp/sm_make_chunk.c
index 17cb400..33aed1c 100644
--- a/net/sctp/sm_make_chunk.c
+++ b/net/sctp/sm_make_chunk.c
@@ -419,10 +419,17 @@  struct sctp_chunk *sctp_make_init_ack(const struct sctp_association *asoc,
 	if (!retval)
 		goto nomem_chunk;
 
-	/* Per the advice in RFC 2960 6.4, send this reply to
-	 * the source of the INIT packet.
+	/* RFC 2960 6.4 Multi-homed SCTP Endpoints
+	 *
+	 * An endpoint SHOULD transmit reply chunks (e.g., SACK,
+	 * HEARTBEAT ACK, * etc.) to the same destination transport
+	 * address from which it received the DATA or control chunk
+	 * to which it is replying.
+	 *
+	 * [INIT ACK back to where the INIT came from.]
 	 */
 	retval->transport = chunk->transport;
+
 	retval->subh.init_hdr =
 		sctp_addto_chunk(retval, sizeof(initack), &initack);
 	retval->param_hdr.v = sctp_addto_chunk(retval, addrs_len, addrs.v);
@@ -461,18 +468,6 @@  struct sctp_chunk *sctp_make_init_ack(const struct sctp_association *asoc,
 	/* We need to remove the const qualifier at this point.  */
 	retval->asoc = (struct sctp_association *) asoc;
 
-	/* RFC 2960 6.4 Multi-homed SCTP Endpoints
-	 *
-	 * An endpoint SHOULD transmit reply chunks (e.g., SACK,
-	 * HEARTBEAT ACK, * etc.) to the same destination transport
-	 * address from which it received the DATA or control chunk
-	 * to which it is replying.
-	 *
-	 * [INIT ACK back to where the INIT came from.]
-	 */
-	if (chunk)
-		retval->transport = chunk->transport;
-
 nomem_chunk:
 	kfree(cookie);
 nomem_cookie: