aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVlad Yasevich <vladislav.yasevich@hp.com>2006-11-09 19:29:57 -0500
committerDavid S. Miller <davem@sunset.davemloft.net>2006-12-03 00:21:47 -0500
commitb68dbcab1dc70938fa5516d0ee82c0bf94e9a768 (patch)
treeef2a69ae0d717be2d62c89c1d5fb144c170ebc29
parent9ec75fe85c58471db958386c1604e5006a2e2f69 (diff)
[SCTP]: Fix warning
An alternate solution would be to make the digest a pointer, allocate it in sctp_endpoint_init() and free it in sctp_endpoint_destroy(). I guess I should have originally done it this way... CC [M] net/sctp/sm_make_chunk.o net/sctp/sm_make_chunk.c: In function 'sctp_unpack_cookie': net/sctp/sm_make_chunk.c:1358: warning: initialization discards qualifiers from pointer target type The reason is that sctp_unpack_cookie() takes a const struct sctp_endpoint and modifies the digest in it (digest being embedded in the struct, not a pointer). Make digest a pointer to fix this warning. Signed-off-by: Vlad Yasevich <vladislav.yasevich@hp.com> Acked-by: Sridhar Samudrala <sri@us.ibm.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--include/net/sctp/structs.h2
-rw-r--r--net/sctp/endpointola.c7
2 files changed, 8 insertions, 1 deletions
diff --git a/include/net/sctp/structs.h b/include/net/sctp/structs.h
index c6d93bb0dcd2..5596f5d97ed2 100644
--- a/include/net/sctp/structs.h
+++ b/include/net/sctp/structs.h
@@ -1270,7 +1270,7 @@ struct sctp_endpoint {
1270 * this here so we pre-allocate this once and can re-use 1270 * this here so we pre-allocate this once and can re-use
1271 * on every receive. 1271 * on every receive.
1272 */ 1272 */
1273 __u8 digest[SCTP_SIGNATURE_SIZE]; 1273 __u8 *digest;
1274 1274
1275 /* sendbuf acct. policy. */ 1275 /* sendbuf acct. policy. */
1276 __u32 sndbuf_policy; 1276 __u32 sndbuf_policy;
diff --git a/net/sctp/endpointola.c b/net/sctp/endpointola.c
index 9b6b394b66f6..090f2b2a0cab 100644
--- a/net/sctp/endpointola.c
+++ b/net/sctp/endpointola.c
@@ -72,6 +72,10 @@ static struct sctp_endpoint *sctp_endpoint_init(struct sctp_endpoint *ep,
72{ 72{
73 memset(ep, 0, sizeof(struct sctp_endpoint)); 73 memset(ep, 0, sizeof(struct sctp_endpoint));
74 74
75 ep->digest = kzalloc(SCTP_SIGNATURE_SIZE, gfp);
76 if (!ep->digest)
77 return NULL;
78
75 /* Initialize the base structure. */ 79 /* Initialize the base structure. */
76 /* What type of endpoint are we? */ 80 /* What type of endpoint are we? */
77 ep->base.type = SCTP_EP_TYPE_SOCKET; 81 ep->base.type = SCTP_EP_TYPE_SOCKET;
@@ -182,6 +186,9 @@ static void sctp_endpoint_destroy(struct sctp_endpoint *ep)
182 /* Free up the HMAC transform. */ 186 /* Free up the HMAC transform. */
183 crypto_free_hash(sctp_sk(ep->base.sk)->hmac); 187 crypto_free_hash(sctp_sk(ep->base.sk)->hmac);
184 188
189 /* Free the digest buffer */
190 kfree(ep->digest);
191
185 /* Cleanup. */ 192 /* Cleanup. */
186 sctp_inq_free(&ep->base.inqueue); 193 sctp_inq_free(&ep->base.inqueue);
187 sctp_bind_addr_free(&ep->base.bind_addr); 194 sctp_bind_addr_free(&ep->base.bind_addr);