From: Vlad Yasevich <vladislav.yasevich@hp.com>
To: Meelis Roos <mroos@linux.ee>
Cc: David Miller <davem@davemloft.net>,
netdev@vger.kernel.org, sri@us.ibm.com,
lksctp-developers@lists.sourceforge.net
Subject: Re: [PATCH] warning in SCTP
Date: Thu, 02 Nov 2006 11:09:26 -0500 [thread overview]
Message-ID: <454A1836.9010709@hp.com> (raw)
In-Reply-To: <Pine.SOC.4.61.0611021119560.1919@math.ut.ee>
[-- Attachment #1: Type: text/plain, Size: 1066 bytes --]
Meelis Roos wrote:
>> Actually, I'm backing this one out, it creates new warnings because
>> callers of this function pass in a "const" pointer.
>
> Yes, it now seems it's not so simple. Marking it non-const there would
> mark the it non-const in the whole family of sctp_state_fn_t and I'm not
> sure that's the best thing to do. I guess the maintainer has better
> bases for deciding what to do about it.
>
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>
[-- Attachment #2: digest.diff --]
[-- Type: text/x-patch, Size: 1184 bytes --]
diff --git a/include/net/sctp/structs.h b/include/net/sctp/structs.h
index c6d93bb..5596f5d 100644
--- a/include/net/sctp/structs.h
+++ b/include/net/sctp/structs.h
@@ -1270,7 +1270,7 @@ struct sctp_endpoint {
* this here so we pre-allocate this once and can re-use
* on every receive.
*/
- __u8 digest[SCTP_SIGNATURE_SIZE];
+ __u8 *digest;
/* sendbuf acct. policy. */
__u32 sndbuf_policy;
diff --git a/net/sctp/endpointola.c b/net/sctp/endpointola.c
index 35c49ff..4576933 100644
--- a/net/sctp/endpointola.c
+++ b/net/sctp/endpointola.c
@@ -72,6 +72,10 @@ static struct sctp_endpoint *sctp_endpoi
{
memset(ep, 0, sizeof(struct sctp_endpoint));
+ ep->digest = kzalloc(SCTP_SIGNATURE_SIZE, gfp);
+ if (!ep->digest)
+ return NULL;
+
/* Initialize the base structure. */
/* What type of endpoint are we? */
ep->base.type = SCTP_EP_TYPE_SOCKET;
@@ -175,6 +180,9 @@ static void sctp_endpoint_destroy(struct
/* Free up the HMAC transform. */
crypto_free_hash(sctp_sk(ep->base.sk)->hmac);
+ /* Free the digest buffer */
+ kfree(ep->digest);
+
/* Cleanup. */
sctp_inq_free(&ep->base.inqueue);
sctp_bind_addr_free(&ep->base.bind_addr);
next prev parent reply other threads:[~2006-11-02 16:09 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-11-02 7:29 [PATCH] warning in SCTP Meelis Roos
2006-11-02 8:16 ` David Miller
2006-11-02 8:22 ` Meelis Roos
2006-11-02 8:30 ` Oleg Verych
2006-11-02 8:39 ` David Miller
2006-11-02 8:49 ` Meelis Roos
2006-11-02 9:12 ` Meelis Roos
2006-11-02 9:22 ` Meelis Roos
2006-11-02 16:09 ` Vlad Yasevich [this message]
2006-11-02 18:29 ` Sridhar Samudrala
2006-11-10 0:30 ` David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=454A1836.9010709@hp.com \
--to=vladislav.yasevich@hp.com \
--cc=davem@davemloft.net \
--cc=lksctp-developers@lists.sourceforge.net \
--cc=mroos@linux.ee \
--cc=netdev@vger.kernel.org \
--cc=sri@us.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).