diff options
author | wangweidong <wangweidong1@huawei.com> | 2013-12-05 20:36:27 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2013-12-06 14:54:38 -0500 |
commit | d1d66186dcec848e89dede4c305f09462e1fbe34 (patch) | |
tree | 9523d80da45c2f222f4732bf1e259cdfa0d53fb7 | |
parent | 19e1190afb6142d375c46991e3830bfbcb2c7315 (diff) |
sctp: remove the duplicate initialize
kzalloc had initialize the allocated memroy. Therefore, remove the
initialize with 0 and the memset.
Acked-by: Neil Horman <nhorman@tuxdriver.com>
Signed-off-by: Wang Weidong <wangweidong1@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | net/sctp/associola.c | 41 |
1 files changed, 0 insertions, 41 deletions
diff --git a/net/sctp/associola.c b/net/sctp/associola.c index 66882a26713b..85295208deb5 100644 --- a/net/sctp/associola.c +++ b/net/sctp/associola.c | |||
@@ -89,14 +89,12 @@ static struct sctp_association *sctp_association_init(struct sctp_association *a | |||
89 | 89 | ||
90 | /* Initialize the object handling fields. */ | 90 | /* Initialize the object handling fields. */ |
91 | atomic_set(&asoc->base.refcnt, 1); | 91 | atomic_set(&asoc->base.refcnt, 1); |
92 | asoc->base.dead = false; | ||
93 | 92 | ||
94 | /* Initialize the bind addr area. */ | 93 | /* Initialize the bind addr area. */ |
95 | sctp_bind_addr_init(&asoc->base.bind_addr, ep->base.bind_addr.port); | 94 | sctp_bind_addr_init(&asoc->base.bind_addr, ep->base.bind_addr.port); |
96 | 95 | ||
97 | asoc->state = SCTP_STATE_CLOSED; | 96 | asoc->state = SCTP_STATE_CLOSED; |
98 | asoc->cookie_life = ms_to_ktime(sp->assocparams.sasoc_cookie_life); | 97 | asoc->cookie_life = ms_to_ktime(sp->assocparams.sasoc_cookie_life); |
99 | asoc->frag_point = 0; | ||
100 | asoc->user_frag = sp->user_frag; | 98 | asoc->user_frag = sp->user_frag; |
101 | 99 | ||
102 | /* Set the association max_retrans and RTO values from the | 100 | /* Set the association max_retrans and RTO values from the |
@@ -109,8 +107,6 @@ static struct sctp_association *sctp_association_init(struct sctp_association *a | |||
109 | asoc->rto_max = msecs_to_jiffies(sp->rtoinfo.srto_max); | 107 | asoc->rto_max = msecs_to_jiffies(sp->rtoinfo.srto_max); |
110 | asoc->rto_min = msecs_to_jiffies(sp->rtoinfo.srto_min); | 108 | asoc->rto_min = msecs_to_jiffies(sp->rtoinfo.srto_min); |
111 | 109 | ||
112 | asoc->overall_error_count = 0; | ||
113 | |||
114 | /* Initialize the association's heartbeat interval based on the | 110 | /* Initialize the association's heartbeat interval based on the |
115 | * sock configured value. | 111 | * sock configured value. |
116 | */ | 112 | */ |
@@ -137,12 +133,9 @@ static struct sctp_association *sctp_association_init(struct sctp_association *a | |||
137 | asoc->max_burst = sp->max_burst; | 133 | asoc->max_burst = sp->max_burst; |
138 | 134 | ||
139 | /* initialize association timers */ | 135 | /* initialize association timers */ |
140 | asoc->timeouts[SCTP_EVENT_TIMEOUT_NONE] = 0; | ||
141 | asoc->timeouts[SCTP_EVENT_TIMEOUT_T1_COOKIE] = asoc->rto_initial; | 136 | asoc->timeouts[SCTP_EVENT_TIMEOUT_T1_COOKIE] = asoc->rto_initial; |
142 | asoc->timeouts[SCTP_EVENT_TIMEOUT_T1_INIT] = asoc->rto_initial; | 137 | asoc->timeouts[SCTP_EVENT_TIMEOUT_T1_INIT] = asoc->rto_initial; |
143 | asoc->timeouts[SCTP_EVENT_TIMEOUT_T2_SHUTDOWN] = asoc->rto_initial; | 138 | asoc->timeouts[SCTP_EVENT_TIMEOUT_T2_SHUTDOWN] = asoc->rto_initial; |
144 | asoc->timeouts[SCTP_EVENT_TIMEOUT_T3_RTX] = 0; | ||
145 | asoc->timeouts[SCTP_EVENT_TIMEOUT_T4_RTO] = 0; | ||
146 | 139 | ||
147 | /* sctpimpguide Section 2.12.2 | 140 | /* sctpimpguide Section 2.12.2 |
148 | * If the 'T5-shutdown-guard' timer is used, it SHOULD be set to the | 141 | * If the 'T5-shutdown-guard' timer is used, it SHOULD be set to the |
@@ -151,7 +144,6 @@ static struct sctp_association *sctp_association_init(struct sctp_association *a | |||
151 | asoc->timeouts[SCTP_EVENT_TIMEOUT_T5_SHUTDOWN_GUARD] | 144 | asoc->timeouts[SCTP_EVENT_TIMEOUT_T5_SHUTDOWN_GUARD] |
152 | = 5 * asoc->rto_max; | 145 | = 5 * asoc->rto_max; |
153 | 146 | ||
154 | asoc->timeouts[SCTP_EVENT_TIMEOUT_HEARTBEAT] = 0; | ||
155 | asoc->timeouts[SCTP_EVENT_TIMEOUT_SACK] = asoc->sackdelay; | 147 | asoc->timeouts[SCTP_EVENT_TIMEOUT_SACK] = asoc->sackdelay; |
156 | asoc->timeouts[SCTP_EVENT_TIMEOUT_AUTOCLOSE] = | 148 | asoc->timeouts[SCTP_EVENT_TIMEOUT_AUTOCLOSE] = |
157 | min_t(unsigned long, sp->autoclose, net->sctp.max_autoclose) * HZ; | 149 | min_t(unsigned long, sp->autoclose, net->sctp.max_autoclose) * HZ; |
@@ -172,11 +164,6 @@ static struct sctp_association *sctp_association_init(struct sctp_association *a | |||
172 | asoc->max_init_timeo = | 164 | asoc->max_init_timeo = |
173 | msecs_to_jiffies(sp->initmsg.sinit_max_init_timeo); | 165 | msecs_to_jiffies(sp->initmsg.sinit_max_init_timeo); |
174 | 166 | ||
175 | /* Allocate storage for the ssnmap after the inbound and outbound | ||
176 | * streams have been negotiated during Init. | ||
177 | */ | ||
178 | asoc->ssnmap = NULL; | ||
179 | |||
180 | /* Set the local window size for receive. | 167 | /* Set the local window size for receive. |
181 | * This is also the rcvbuf space per association. | 168 | * This is also the rcvbuf space per association. |
182 | * RFC 6 - A SCTP receiver MUST be able to receive a minimum of | 169 | * RFC 6 - A SCTP receiver MUST be able to receive a minimum of |
@@ -189,25 +176,15 @@ static struct sctp_association *sctp_association_init(struct sctp_association *a | |||
189 | 176 | ||
190 | asoc->a_rwnd = asoc->rwnd; | 177 | asoc->a_rwnd = asoc->rwnd; |
191 | 178 | ||
192 | asoc->rwnd_over = 0; | ||
193 | asoc->rwnd_press = 0; | ||
194 | |||
195 | /* Use my own max window until I learn something better. */ | 179 | /* Use my own max window until I learn something better. */ |
196 | asoc->peer.rwnd = SCTP_DEFAULT_MAXWINDOW; | 180 | asoc->peer.rwnd = SCTP_DEFAULT_MAXWINDOW; |
197 | 181 | ||
198 | /* Set the sndbuf size for transmit. */ | ||
199 | asoc->sndbuf_used = 0; | ||
200 | |||
201 | /* Initialize the receive memory counter */ | 182 | /* Initialize the receive memory counter */ |
202 | atomic_set(&asoc->rmem_alloc, 0); | 183 | atomic_set(&asoc->rmem_alloc, 0); |
203 | 184 | ||
204 | init_waitqueue_head(&asoc->wait); | 185 | init_waitqueue_head(&asoc->wait); |
205 | 186 | ||
206 | asoc->c.my_vtag = sctp_generate_tag(ep); | 187 | asoc->c.my_vtag = sctp_generate_tag(ep); |
207 | asoc->peer.i.init_tag = 0; /* INIT needs a vtag of 0. */ | ||
208 | asoc->c.peer_vtag = 0; | ||
209 | asoc->c.my_ttag = 0; | ||
210 | asoc->c.peer_ttag = 0; | ||
211 | asoc->c.my_port = ep->base.bind_addr.port; | 188 | asoc->c.my_port = ep->base.bind_addr.port; |
212 | 189 | ||
213 | asoc->c.initial_tsn = sctp_generate_tsn(ep); | 190 | asoc->c.initial_tsn = sctp_generate_tsn(ep); |
@@ -218,7 +195,6 @@ static struct sctp_association *sctp_association_init(struct sctp_association *a | |||
218 | asoc->adv_peer_ack_point = asoc->ctsn_ack_point; | 195 | asoc->adv_peer_ack_point = asoc->ctsn_ack_point; |
219 | asoc->highest_sacked = asoc->ctsn_ack_point; | 196 | asoc->highest_sacked = asoc->ctsn_ack_point; |
220 | asoc->last_cwr_tsn = asoc->ctsn_ack_point; | 197 | asoc->last_cwr_tsn = asoc->ctsn_ack_point; |
221 | asoc->unack_data = 0; | ||
222 | 198 | ||
223 | /* ADDIP Section 4.1 Asconf Chunk Procedures | 199 | /* ADDIP Section 4.1 Asconf Chunk Procedures |
224 | * | 200 | * |
@@ -237,7 +213,6 @@ static struct sctp_association *sctp_association_init(struct sctp_association *a | |||
237 | 213 | ||
238 | /* Make an empty list of remote transport addresses. */ | 214 | /* Make an empty list of remote transport addresses. */ |
239 | INIT_LIST_HEAD(&asoc->peer.transport_addr_list); | 215 | INIT_LIST_HEAD(&asoc->peer.transport_addr_list); |
240 | asoc->peer.transport_count = 0; | ||
241 | 216 | ||
242 | /* RFC 2960 5.1 Normal Establishment of an Association | 217 | /* RFC 2960 5.1 Normal Establishment of an Association |
243 | * | 218 | * |
@@ -251,7 +226,6 @@ static struct sctp_association *sctp_association_init(struct sctp_association *a | |||
251 | * already received one packet.] | 226 | * already received one packet.] |
252 | */ | 227 | */ |
253 | asoc->peer.sack_needed = 1; | 228 | asoc->peer.sack_needed = 1; |
254 | asoc->peer.sack_cnt = 0; | ||
255 | asoc->peer.sack_generation = 1; | 229 | asoc->peer.sack_generation = 1; |
256 | 230 | ||
257 | /* Assume that the peer will tell us if he recognizes ASCONF | 231 | /* Assume that the peer will tell us if he recognizes ASCONF |
@@ -259,12 +233,8 @@ static struct sctp_association *sctp_association_init(struct sctp_association *a | |||
259 | * The sctp_addip_noauth option is there for backward compatibilty | 233 | * The sctp_addip_noauth option is there for backward compatibilty |
260 | * and will revert old behavior. | 234 | * and will revert old behavior. |
261 | */ | 235 | */ |
262 | asoc->peer.asconf_capable = 0; | ||
263 | if (net->sctp.addip_noauth) | 236 | if (net->sctp.addip_noauth) |
264 | asoc->peer.asconf_capable = 1; | 237 | asoc->peer.asconf_capable = 1; |
265 | asoc->asconf_addr_del_pending = NULL; | ||
266 | asoc->src_out_of_asoc_ok = 0; | ||
267 | asoc->new_transport = NULL; | ||
268 | 238 | ||
269 | /* Create an input queue. */ | 239 | /* Create an input queue. */ |
270 | sctp_inq_init(&asoc->base.inqueue); | 240 | sctp_inq_init(&asoc->base.inqueue); |
@@ -276,12 +246,6 @@ static struct sctp_association *sctp_association_init(struct sctp_association *a | |||
276 | if (!sctp_ulpq_init(&asoc->ulpq, asoc)) | 246 | if (!sctp_ulpq_init(&asoc->ulpq, asoc)) |
277 | goto fail_init; | 247 | goto fail_init; |
278 | 248 | ||
279 | memset(&asoc->peer.tsn_map, 0, sizeof(struct sctp_tsnmap)); | ||
280 | |||
281 | asoc->need_ecne = 0; | ||
282 | |||
283 | asoc->assoc_id = 0; | ||
284 | |||
285 | /* Assume that peer would support both address types unless we are | 249 | /* Assume that peer would support both address types unless we are |
286 | * told otherwise. | 250 | * told otherwise. |
287 | */ | 251 | */ |
@@ -299,9 +263,6 @@ static struct sctp_association *sctp_association_init(struct sctp_association *a | |||
299 | asoc->default_timetolive = sp->default_timetolive; | 263 | asoc->default_timetolive = sp->default_timetolive; |
300 | asoc->default_rcv_context = sp->default_rcv_context; | 264 | asoc->default_rcv_context = sp->default_rcv_context; |
301 | 265 | ||
302 | /* SCTP_GET_ASSOC_STATS COUNTERS */ | ||
303 | memset(&asoc->stats, 0, sizeof(struct sctp_priv_assoc_stats)); | ||
304 | |||
305 | /* AUTH related initializations */ | 266 | /* AUTH related initializations */ |
306 | INIT_LIST_HEAD(&asoc->endpoint_shared_keys); | 267 | INIT_LIST_HEAD(&asoc->endpoint_shared_keys); |
307 | err = sctp_auth_asoc_copy_shkeys(ep, asoc, gfp); | 268 | err = sctp_auth_asoc_copy_shkeys(ep, asoc, gfp); |
@@ -309,9 +270,7 @@ static struct sctp_association *sctp_association_init(struct sctp_association *a | |||
309 | goto fail_init; | 270 | goto fail_init; |
310 | 271 | ||
311 | asoc->active_key_id = ep->active_key_id; | 272 | asoc->active_key_id = ep->active_key_id; |
312 | asoc->asoc_shared_key = NULL; | ||
313 | 273 | ||
314 | asoc->default_hmac_id = 0; | ||
315 | /* Save the hmacs and chunks list into this association */ | 274 | /* Save the hmacs and chunks list into this association */ |
316 | if (ep->auth_hmacs_list) | 275 | if (ep->auth_hmacs_list) |
317 | memcpy(asoc->c.auth_hmacs, ep->auth_hmacs_list, | 276 | memcpy(asoc->c.auth_hmacs, ep->auth_hmacs_list, |