diff options
author | Arnaldo Carvalho de Melo <acme@mandriva.com> | 2006-11-20 22:20:33 -0500 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2006-12-03 00:30:19 -0500 |
commit | af997d8c9568d556cd0a362d56de9fb14a6a012a (patch) | |
tree | 731bfb8ed8e3202fd4b5a9610c05b1859fe4f4ad | |
parent | c7b1b24978d89efab7d420bbdc9557dbe6259c89 (diff) |
[SCTP]: Use kzalloc where appropriate
Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>
-rw-r--r-- | net/sctp/sm_make_chunk.c | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/net/sctp/sm_make_chunk.c b/net/sctp/sm_make_chunk.c index 988745272458..04954e5f6846 100644 --- a/net/sctp/sm_make_chunk.c +++ b/net/sctp/sm_make_chunk.c | |||
@@ -1279,15 +1279,13 @@ static sctp_cookie_param_t *sctp_pack_cookie(const struct sctp_endpoint *ep, | |||
1279 | - (bodysize % SCTP_COOKIE_MULTIPLE); | 1279 | - (bodysize % SCTP_COOKIE_MULTIPLE); |
1280 | *cookie_len = headersize + bodysize; | 1280 | *cookie_len = headersize + bodysize; |
1281 | 1281 | ||
1282 | retval = kmalloc(*cookie_len, GFP_ATOMIC); | ||
1283 | |||
1284 | if (!retval) | ||
1285 | goto nodata; | ||
1286 | |||
1287 | /* Clear this memory since we are sending this data structure | 1282 | /* Clear this memory since we are sending this data structure |
1288 | * out on the network. | 1283 | * out on the network. |
1289 | */ | 1284 | */ |
1290 | memset(retval, 0x00, *cookie_len); | 1285 | retval = kzalloc(*cookie_len, GFP_ATOMIC); |
1286 | if (!retval) | ||
1287 | goto nodata; | ||
1288 | |||
1291 | cookie = (struct sctp_signed_cookie *) retval->body; | 1289 | cookie = (struct sctp_signed_cookie *) retval->body; |
1292 | 1290 | ||
1293 | /* Set up the parameter header. */ | 1291 | /* Set up the parameter header. */ |
@@ -1910,10 +1908,9 @@ int sctp_process_init(struct sctp_association *asoc, sctp_cid_t cid, | |||
1910 | /* Copy cookie in case we need to resend COOKIE-ECHO. */ | 1908 | /* Copy cookie in case we need to resend COOKIE-ECHO. */ |
1911 | cookie = asoc->peer.cookie; | 1909 | cookie = asoc->peer.cookie; |
1912 | if (cookie) { | 1910 | if (cookie) { |
1913 | asoc->peer.cookie = kmalloc(asoc->peer.cookie_len, gfp); | 1911 | asoc->peer.cookie = kmemdup(cookie, asoc->peer.cookie_len, gfp); |
1914 | if (!asoc->peer.cookie) | 1912 | if (!asoc->peer.cookie) |
1915 | goto clean_up; | 1913 | goto clean_up; |
1916 | memcpy(asoc->peer.cookie, cookie, asoc->peer.cookie_len); | ||
1917 | } | 1914 | } |
1918 | 1915 | ||
1919 | /* RFC 2960 7.2.1 The initial value of ssthresh MAY be arbitrarily | 1916 | /* RFC 2960 7.2.1 The initial value of ssthresh MAY be arbitrarily |