netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Xin Long <lucien.xin@gmail.com>
To: network dev <netdev@vger.kernel.org>, linux-sctp@vger.kernel.org
Cc: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>,
	Neil Horman <nhorman@tuxdriver.com>,
	davem@davemloft.net
Subject: [PATCH net-next 14/14] sctp: remove the typedef sctp_auth_chunk_t
Date: Thu,  3 Aug 2017 15:42:22 +0800	[thread overview]
Message-ID: <374643eb449c9ec7392926d06fa3aade318b7cba.1501745729.git.lucien.xin@gmail.com> (raw)
In-Reply-To: <99eaf082a43fa5cd141ad9e25b9a7de3f33d69b7.1501745729.git.lucien.xin@gmail.com>
In-Reply-To: <cover.1501745729.git.lucien.xin@gmail.com>

This patch is to remove the typedef sctp_auth_chunk_t, and
replace with struct sctp_auth_chunk in the places where it's
using this typedef.

It is also to use sizeof(variable) instead of sizeof(type).

Signed-off-by: Xin Long <lucien.xin@gmail.com>
---
 include/linux/sctp.h    | 4 ++--
 net/sctp/chunk.c        | 2 +-
 net/sctp/sm_statefuns.c | 9 +++++----
 3 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/include/linux/sctp.h b/include/linux/sctp.h
index b7603f5..82b171e 100644
--- a/include/linux/sctp.h
+++ b/include/linux/sctp.h
@@ -699,10 +699,10 @@ struct sctp_authhdr {
 	__u8   hmac[0];
 };
 
-typedef struct sctp_auth_chunk {
+struct sctp_auth_chunk {
 	struct sctp_chunkhdr chunk_hdr;
 	struct sctp_authhdr auth_hdr;
-} sctp_auth_chunk_t;
+};
 
 struct sctp_infox {
 	struct sctp_info *sctpinfo;
diff --git a/net/sctp/chunk.c b/net/sctp/chunk.c
index 681b181..3afac27 100644
--- a/net/sctp/chunk.c
+++ b/net/sctp/chunk.c
@@ -201,7 +201,7 @@ 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 -= SCTP_PAD4(sizeof(sctp_auth_chunk_t) +
+			max_data -= SCTP_PAD4(sizeof(struct sctp_auth_chunk) +
 					      hmac_desc->hmac_len);
 	}
 
diff --git a/net/sctp/sm_statefuns.c b/net/sctp/sm_statefuns.c
index 9c235bb..8af90a5 100644
--- a/net/sctp/sm_statefuns.c
+++ b/net/sctp/sm_statefuns.c
@@ -4093,7 +4093,7 @@ static sctp_ierror_t sctp_sf_authenticate(struct net *net,
 	/* Pull in the auth header, so we can do some more verification */
 	auth_hdr = (struct sctp_authhdr *)chunk->skb->data;
 	chunk->subh.auth_hdr = auth_hdr;
-	skb_pull(chunk->skb, sizeof(struct sctp_authhdr));
+	skb_pull(chunk->skb, sizeof(*auth_hdr));
 
 	/* Make sure that we support the HMAC algorithm from the auth
 	 * chunk.
@@ -4112,7 +4112,8 @@ static sctp_ierror_t sctp_sf_authenticate(struct net *net,
 	/* Make sure that the length of the signature matches what
 	 * we expect.
 	 */
-	sig_len = ntohs(chunk->chunk_hdr->length) - sizeof(sctp_auth_chunk_t);
+	sig_len = ntohs(chunk->chunk_hdr->length) -
+		  sizeof(struct sctp_auth_chunk);
 	hmac = sctp_auth_get_hmac(ntohs(auth_hdr->hmac_id));
 	if (sig_len != hmac->hmac_len)
 		return SCTP_IERROR_PROTO_VIOLATION;
@@ -4134,8 +4135,8 @@ static sctp_ierror_t sctp_sf_authenticate(struct net *net,
 	memset(digest, 0, sig_len);
 
 	sctp_auth_calculate_hmac(asoc, chunk->skb,
-				(struct sctp_auth_chunk *)chunk->chunk_hdr,
-				GFP_ATOMIC);
+				 (struct sctp_auth_chunk *)chunk->chunk_hdr,
+				 GFP_ATOMIC);
 
 	/* Discard the packet if the digests do not match */
 	if (memcmp(save_digest, digest, sig_len)) {
-- 
2.1.0

  reply	other threads:[~2017-08-03  7:44 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-03  7:42 [PATCH net-next 00/14] sctp: remove typedefs from structures part 4 Xin Long
2017-08-03  7:42 ` [PATCH net-next 01/14] sctp: remove the typedef sctp_shutdownhdr_t Xin Long
2017-08-03  7:42   ` [PATCH net-next 02/14] sctp: fix the name of struct sctp_shutdown_chunk_t Xin Long
2017-08-03  7:42     ` [PATCH net-next 03/14] sctp: remove the typedef sctp_errhdr_t Xin Long
2017-08-03  7:42       ` [PATCH net-next 04/14] sctp: remove the typedef sctp_operr_chunk_t Xin Long
2017-08-03  7:42         ` [PATCH net-next 05/14] sctp: remove the typedef sctp_error_t Xin Long
2017-08-03  7:42           ` [PATCH net-next 06/14] sctp: remove the typedef sctp_ecnehdr_t Xin Long
2017-08-03  7:42             ` [PATCH net-next 07/14] sctp: remove the typedef sctp_ecne_chunk_t Xin Long
2017-08-03  7:42               ` [PATCH net-next 08/14] sctp: remove the typedef sctp_cwrhdr_t Xin Long
2017-08-03  7:42                 ` [PATCH net-next 09/14] sctp: remove the typedef sctp_cwr_chunk_t Xin Long
2017-08-03  7:42                   ` [PATCH net-next 10/14] sctp: remove the typedef sctp_addip_param_t Xin Long
2017-08-03  7:42                     ` [PATCH net-next 11/14] sctp: remove the typedef sctp_addiphdr_t Xin Long
2017-08-03  7:42                       ` [PATCH net-next 12/14] sctp: remove the typedef sctp_addip_chunk_t Xin Long
2017-08-03  7:42                         ` [PATCH net-next 13/14] sctp: remove the typedef sctp_authhdr_t Xin Long
2017-08-03  7:42                           ` Xin Long [this message]
2017-08-03 16:46 ` [PATCH net-next 00/14] sctp: remove typedefs from structures part 4 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=374643eb449c9ec7392926d06fa3aade318b7cba.1501745729.git.lucien.xin@gmail.com \
    --to=lucien.xin@gmail.com \
    --cc=davem@davemloft.net \
    --cc=linux-sctp@vger.kernel.org \
    --cc=marcelo.leitner@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=nhorman@tuxdriver.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).