Skip to contentSkip to conversation

net: sctp: minor: remove dead code from sctp_packet

PATCH Applied Daniel Borkmann 2 participants 2 messages Apr 19, 2013 – Apr 22, 2013

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

PATCH 1/1 net: sctp: minor: remove dead code from sctp_packet

struct sctp_packet is currently embedded into sctp_transport or sits on the stack as 'singleton' in sctp_outq_flush(). Therefore, its member 'malloced' is always 0, thus a kfree() is never called. Because of that, we can just remove this code.

---
That is finally the last one of all these cases to get rid of 'malloced' structure members.

 include/net/sctp/structs.h | 3 +--
 net/sctp/output.c          | 5 +----
 2 files changed, 2 insertions(+), 6 deletions(-)
include/net/sctp/structs.h +1 -2
index 64d4698..1bd4c41 100644
@@ -714,8 +714,7 @@ struct sctp_packet {
 	    has_sack:1,		/* This packet contains a SACK chunk. */
 	    has_auth:1,		/* This packet contains an AUTH chunk */
 	    has_data:1,		/* This packet contains at least 1 DATA chunk */
-	    ipfragok:1,		/* So let ip fragment this packet */
-	    malloced:1;		/* Is it malloced? */
+	    ipfragok:1;		/* So let ip fragment this packet */
 };
 
 struct sctp_packet *sctp_packet_init(struct sctp_packet *,
net/sctp/output.c +1 -4
index f5200a2..bbef4a7 100644
@@ -136,7 +136,7 @@ struct sctp_packet *sctp_packet_init(struct sctp_packet *packet,
 	packet->overhead = overhead;
 	sctp_packet_reset(packet);
 	packet->vtag = 0;
-	packet->malloced = 0;
+
 	return packet;
 }
 
@@ -151,9 +151,6 @@ void sctp_packet_free(struct sctp_packet *packet)
 		list_del_init(&chunk->list);
 		sctp_chunk_free(chunk);
 	}
-
-	if (packet->malloced)
-		kfree(packet);
 }
 
 /* This routine tries to append the chunk to the offered packet. If adding
Signature · 1 line
1.7.11.7
maintainer Applied
#1 lore raw

From: Daniel Borkmann <[email protected]>
Date: Fri, 19 Apr 2013 09:59:37 +0200

Quoted 6 lines

struct sctp_packet is currently embedded into sctp_transport or sits on the stack as 'singleton' in sctp_outq_flush(). Therefore, its member 'malloced' is always 0, thus a kfree() is never called. Because of that, we can just remove this code.

Applied, thanks.