sctp: make use of SCTP_TRUNC4 macro
[cascardo/linux.git] / net / sctp / chunk.c
index af9cc80..8afe2e9 100644 (file)
@@ -195,9 +195,10 @@ struct sctp_datamsg *sctp_datamsg_from_user(struct sctp_association *asoc,
        /* This is the biggest possible DATA chunk that can fit into
         * the packet
         */
-       max_data = (asoc->pathmtu -
-               sctp_sk(asoc->base.sk)->pf->af->net_header_len -
-               sizeof(struct sctphdr) - sizeof(struct sctp_data_chunk)) & ~3;
+       max_data = asoc->pathmtu -
+                  sctp_sk(asoc->base.sk)->pf->af->net_header_len -
+                  sizeof(struct sctphdr) - sizeof(struct sctp_data_chunk);
+       max_data = SCTP_TRUNC4(max_data);
 
        max = asoc->frag_point;
        /* If the the peer requested that we authenticate DATA chunks
@@ -208,8 +209,8 @@ struct sctp_datamsg *sctp_datamsg_from_user(struct sctp_association *asoc,
                struct sctp_hmac *hmac_desc = sctp_auth_asoc_get_hmac(asoc);
 
                if (hmac_desc)
-                       max_data -= WORD_ROUND(sizeof(sctp_auth_chunk_t) +
-                                           hmac_desc->hmac_len);
+                       max_data -= SCTP_PAD4(sizeof(sctp_auth_chunk_t) +
+                                             hmac_desc->hmac_len);
        }
 
        /* Now, check if we need to reduce our max */
@@ -229,7 +230,7 @@ struct sctp_datamsg *sctp_datamsg_from_user(struct sctp_association *asoc,
            asoc->outqueue.out_qlen == 0 &&
            list_empty(&asoc->outqueue.retransmit) &&
            msg_len > max)
-               max_data -= WORD_ROUND(sizeof(sctp_sack_chunk_t));
+               max_data -= SCTP_PAD4(sizeof(sctp_sack_chunk_t));
 
        /* Encourage Cookie-ECHO bundling. */
        if (asoc->state < SCTP_STATE_COOKIE_ECHOED)