From patchwork Sun Jul 23 01:34:26 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xin Long X-Patchwork-Id: 792505 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="p102O8/N"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3xFRrt6KSrz9sPs for ; Sun, 23 Jul 2017 11:35:10 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755170AbdGWBez (ORCPT ); Sat, 22 Jul 2017 21:34:55 -0400 Received: from mail-pf0-f195.google.com ([209.85.192.195]:33889 "EHLO mail-pf0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754501AbdGWBex (ORCPT ); Sat, 22 Jul 2017 21:34:53 -0400 Received: by mail-pf0-f195.google.com with SMTP id o88so7668910pfk.1; Sat, 22 Jul 2017 18:34:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=z35CCMRaUjIRJ9wKckTV8oZZu8j8/b/92jZjaORITws=; b=p102O8/NaWnUWZy+g9ViNU3TU+R5zerAzu1ObFrah+Y7eJGfttNn3KOnBSIR0TaWd2 YUtXp+ZroZDYEkVNOZfKb0B17FttvvWM8/gNlOWrTJ+r4jqk+o9klqYbxVLQPPgB68PG sQyTWXIwN0OxviNiwfwA3bgCHEfp3J8NBHPaiFoSvlR84OQejQb+py1iyKBNj6x9rdg7 CAxJifMm2x4YIdOH7NysX5xccnZQk6MPVwbqIjKsaGpFZctdh0Ur1SD7/nOdiRcpmTmj v3OuSw4W6W5AK9bqgzSEdT+Q2L5Q0SWcDjAB9eHu0QmKGdPvC6JBUXU3kMFIu/TtRJ5T 5RAQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=z35CCMRaUjIRJ9wKckTV8oZZu8j8/b/92jZjaORITws=; b=MKxE99Pv+zagkQObd/4tMQ5oS2VqsDB4vbmtZUGSnQGSVb3XrkCOVmY2cywhrh6djB Zc9xbMf71lEmbcpod8mL8tlYwKsdygjSaYGuhE4MPvrqFmehtC5RQCx8LnnGshZrsNWJ 4S2rsWFoABN5UkmJWzvHbk3Y2uNj0WiELeu9j3dQZPNajO1ARJSmJmbYgnbDu2kp++ni GS9xXlzKJuvrEDZgQ4rAK8qRP1AVmjzuQMnsGMC2tK2tTVNYgySfz8osBUWx/82sRVwV KxSBZxgyMh3N1zzGhBUOs/8ZXgzY2Xf5RDp2n0jcMwZlickY8MXZGdDm1CCsVUfuD4p4 uejw== X-Gm-Message-State: AIVw112Pm+5hquNsSE5cjjbtPB6j1o+gUXflXoK4bkkf86yIBso52JBy 7A8GY52H6ZORrW1XMCA= X-Received: by 10.98.100.204 with SMTP id y195mr11834467pfb.303.1500773692952; Sat, 22 Jul 2017 18:34:52 -0700 (PDT) Received: from localhost ([209.132.188.80]) by smtp.gmail.com with ESMTPSA id a86sm92600pfe.101.2017.07.22.18.34.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 22 Jul 2017 18:34:52 -0700 (PDT) From: Xin Long To: network dev , linux-sctp@vger.kernel.org Cc: Marcelo Ricardo Leitner , Neil Horman , davem@davemloft.net Subject: [PATCH net-next 01/11] sctp: remove the typedef sctp_initack_chunk_t Date: Sun, 23 Jul 2017 09:34:26 +0800 Message-Id: X-Mailer: git-send-email 2.1.0 In-Reply-To: References: In-Reply-To: References: Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org This patch is to remove the typedef sctp_initack_chunk_t, and replace with struct sctp_initack_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 --- include/linux/sctp.h | 5 ++++- net/sctp/sm_statefuns.c | 13 ++++++------- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/include/linux/sctp.h b/include/linux/sctp.h index 913474d..05c2099 100644 --- a/include/linux/sctp.h +++ b/include/linux/sctp.h @@ -336,7 +336,10 @@ struct sctp_hmac_algo_param { * The INIT ACK chunk is used to acknowledge the initiation of an SCTP * association. */ -typedef struct sctp_init_chunk sctp_initack_chunk_t; +struct sctp_initack_chunk { + struct sctp_chunkhdr chunk_hdr; + struct sctp_inithdr init_hdr; +}; /* Section 3.3.3.1 State Cookie (7) */ typedef struct sctp_cookie_param { diff --git a/net/sctp/sm_statefuns.c b/net/sctp/sm_statefuns.c index ae4c48c..6568fc3 100644 --- a/net/sctp/sm_statefuns.c +++ b/net/sctp/sm_statefuns.c @@ -518,7 +518,7 @@ sctp_disposition_t sctp_sf_do_5_1C_ack(struct net *net, return sctp_sf_violation_chunk(net, ep, asoc, type, arg, commands); /* Make sure that the INIT-ACK chunk has a valid length */ - if (!sctp_chunk_length_valid(chunk, sizeof(sctp_initack_chunk_t))) + if (!sctp_chunk_length_valid(chunk, sizeof(struct sctp_initack_chunk))) return sctp_sf_violation_chunklen(net, ep, asoc, type, arg, commands); /* Grab the INIT header. */ @@ -4453,11 +4453,10 @@ static sctp_disposition_t sctp_sf_abort_violation( /* Treat INIT-ACK as a special case during COOKIE-WAIT. */ if (chunk->chunk_hdr->type == SCTP_CID_INIT_ACK && !asoc->peer.i.init_tag) { - sctp_initack_chunk_t *initack; + struct sctp_initack_chunk *initack; - initack = (sctp_initack_chunk_t *)chunk->chunk_hdr; - if (!sctp_chunk_length_valid(chunk, - sizeof(sctp_initack_chunk_t))) + initack = (struct sctp_initack_chunk *)chunk->chunk_hdr; + if (!sctp_chunk_length_valid(chunk, sizeof(*initack))) abort->chunk_hdr->flags |= SCTP_CHUNK_FLAG_T; else { unsigned int inittag; @@ -6106,9 +6105,9 @@ static struct sctp_packet *sctp_ootb_pkt_new(struct net *net, switch (chunk->chunk_hdr->type) { case SCTP_CID_INIT_ACK: { - sctp_initack_chunk_t *initack; + struct sctp_initack_chunk *initack; - initack = (sctp_initack_chunk_t *)chunk->chunk_hdr; + initack = (struct sctp_initack_chunk *)chunk->chunk_hdr; vtag = ntohl(initack->init_hdr.init_tag); break; }