]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/blobdiff - net/sctp/sm_make_chunk.c
networking: introduce and use skb_put_data()
[mirror_ubuntu-artful-kernel.git] / net / sctp / sm_make_chunk.c
index 92e332e173914f16c10ba54038dbb78dee0d0c49..034e916362cf99495c722bc5f3d307d9fbd97464 100644 (file)
@@ -1296,8 +1296,7 @@ struct sctp_chunk *sctp_make_auth(const struct sctp_association *asoc)
        retval->subh.auth_hdr = sctp_addto_chunk(retval, sizeof(sctp_authhdr_t),
                                                &auth_hdr);
 
-       hmac = skb_put(retval->skb, hmac_desc->hmac_len);
-       memset(hmac, 0, hmac_desc->hmac_len);
+       hmac = skb_put_zero(retval->skb, hmac_desc->hmac_len);
 
        /* Adjust the chunk header to include the empty MAC */
        retval->chunk_hdr->length =
@@ -1479,11 +1478,8 @@ void *sctp_addto_chunk(struct sctp_chunk *chunk, int len, const void *data)
        int chunklen = ntohs(chunk->chunk_hdr->length);
        int padlen = SCTP_PAD4(chunklen) - chunklen;
 
-       padding = skb_put(chunk->skb, padlen);
-       target = skb_put(chunk->skb, len);
-
-       memset(padding, 0, padlen);
-       memcpy(target, data, len);
+       padding = skb_put_zero(chunk->skb, padlen);
+       target = skb_put_data(chunk->skb, data, len);
 
        /* Adjust the chunk length field.  */
        chunk->chunk_hdr->length = htons(chunklen + padlen + len);
@@ -1544,7 +1540,7 @@ void sctp_chunk_assign_ssn(struct sctp_chunk *chunk)
 
        /* All fragments will be on the same stream */
        sid = ntohs(chunk->subh.data_hdr->stream);
-       stream = chunk->asoc->stream;
+       stream = &chunk->asoc->stream;
 
        /* Now assign the sequence number to the entire message.
         * All fragments must have the same stream sequence number.
@@ -2454,7 +2450,8 @@ int sctp_process_init(struct sctp_association *asoc, struct sctp_chunk *chunk,
         * stream sequence number shall be set to 0.
         */
 
-       if (sctp_stream_init(asoc, gfp))
+       if (sctp_stream_init(&asoc->stream, asoc->c.sinit_num_ostreams,
+                            asoc->c.sinit_max_instreams, gfp))
                goto clean_up;
 
        if (!asoc->temp && sctp_assoc_set_id(asoc, gfp))