From patchwork Mon Mar 22 16:21:31 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthieu Baerts X-Patchwork-Id: 1456732 X-Patchwork-Delegate: matthieu.baerts@tessares.net Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.01.org (client-ip=198.145.21.10; helo=ml01.01.org; envelope-from=mptcp-bounces@lists.01.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=tessares-net.20150623.gappssmtp.com header.i=@tessares-net.20150623.gappssmtp.com header.a=rsa-sha256 header.s=20150623 header.b=aYdtj9is; dkim-atps=neutral Received: from ml01.01.org (ml01.01.org [198.145.21.10]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4F40Bf4J2Pz9sRR for ; Tue, 23 Mar 2021 03:22:01 +1100 (AEDT) Received: from ml01.vlan13.01.org (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 66E52100EB82A; Mon, 22 Mar 2021 09:21:59 -0700 (PDT) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=2a00:1450:4864:20::532; helo=mail-ed1-x532.google.com; envelope-from=matthieu.baerts@tessares.net; receiver= Received: from mail-ed1-x532.google.com (mail-ed1-x532.google.com [IPv6:2a00:1450:4864:20::532]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 8E23C100EBB9E for ; Mon, 22 Mar 2021 09:21:52 -0700 (PDT) Received: by mail-ed1-x532.google.com with SMTP id bf3so20100891edb.6 for ; Mon, 22 Mar 2021 09:21:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tessares-net.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ivbpaTVVBL4MEMu0vTeFeHFl9GFbfW0NHTnFMqxMujk=; b=aYdtj9iscXf8uci93ZtaCCivwjIHwc7M2wnO6k4iyTt9u9o7I6vhXHo4+Tuuc7fQ7k K55hrpLqCoqiew8HG/P9nDmpzSUgfgHkCOZUSZN3upRlr3jdlZLw9akwv/tjG5d9NEo6 XDF1D3o4Zy9IVns/FLIlQfDkzDawzgIkLkTnEC9JjXEc/KFJAbYQeO6e+mJ5z7e5ZSJ6 OmEbJsoOJeVkaNXOEB6Wpo/X/2RItsHZiZj6178tHGqQap4zkgodcs6uEZXKuavhgEyM Zu+mQJr/skgcopYjXF7Pnl1KrxZhFdPAt/wm7aBUUlJmDDHWwfhtSzOF6fbIq2miAJYn ccTQ== 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:mime-version:content-transfer-encoding; bh=ivbpaTVVBL4MEMu0vTeFeHFl9GFbfW0NHTnFMqxMujk=; b=c1lXJfDYA7eMyhlTHmsVa6KPkjnTOp7ENJL6JU/tKle5hXcaepoJxAZj2NqcFNoRuY P2fmK2DUxpmPjwG4mQd4G/wmGJ3nTyVNQ5Ldp37mzKs+TlcBqJl2gc8FMKvR80dEp/BG D9PqudPmZ7LmLhsMb9t1MSVWrGD5FYS6w04BGQVnc8jPqYm2uGsgHRZ2e4nUfEYBL86y Q/yGBsJer3VjaXiA0/XRH/TA9EuO3v0vvnk1ygd4JJy2NSX26WGA88LSlkRsOUuPoxbL TZ0FimLnZibnUZoSNW3sJ5K8SNT7c+wwZ7gU/5UzPcjBgnU7EV7Wz40oXHYZAG0FvvDu B4Hg== X-Gm-Message-State: AOAM531nx7fPpmCmioZiy4e8PT/r1Rzn0WGBOIjLg6kwy/xHUiPYlEbA yIk4Zizpucj8IqX7smJh+3oOHL+ZQJQnHfgL X-Google-Smtp-Source: ABdhPJwiuvXEL9eKjBSo3Xc3vrpyYjknfEsd6XH0rv0a8SdIjhU1ZZcxcNOXUUH16UH1++CbM0VMxA== X-Received: by 2002:aa7:d9c8:: with SMTP id v8mr357850eds.9.1616430111242; Mon, 22 Mar 2021 09:21:51 -0700 (PDT) Received: from tsr-vdi-mbaerts.nix.tessares.net (static.23.216.130.94.clients.your-server.de. [94.130.216.23]) by smtp.gmail.com with ESMTPSA id wr20sm5694136ejb.111.2021.03.22.09.21.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Mar 2021 09:21:50 -0700 (PDT) From: Matthieu Baerts To: mptcp@lists.linux.dev, mptcp@lists.01.org Date: Mon, 22 Mar 2021 17:21:31 +0100 Message-Id: <20210322162132.2471823-2-matthieu.baerts@tessares.net> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210322162132.2471823-1-matthieu.baerts@tessares.net> References: <20210322162132.2471823-1-matthieu.baerts@tessares.net> MIME-Version: 1.0 Message-ID-Hash: DJQDFUV3MHX7CFN532VE3K4DA4KGXCXW X-Message-ID-Hash: DJQDFUV3MHX7CFN532VE3K4DA4KGXCXW X-MailFrom: matthieu.baerts@tessares.net X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header CC: Geliang Tang X-Mailman-Version: 3.1.1 Precedence: list Subject: [MPTCP] [PATCH mptcp-next 2/3] Squash to "mptcp: use mptcp_addr_info in mptcp_options_received" List-Id: Discussions regarding MPTCP upstreaming Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: Fix issues reported by sparse because we were doing non explicit casting from __be16 to u16 and the opposite. net/mptcp/options.c:251:51: warning: incorrect type in assignment (different base types) net/mptcp/options.c:251:51: expected restricted __be16 [usertype] port net/mptcp/options.c:251:51: got unsigned short net/mptcp/options.c:261:51: warning: incorrect type in assignment (different base types) net/mptcp/options.c:261:51: expected restricted __be16 [usertype] port net/mptcp/options.c:261:51: got unsigned short net/mptcp/options.c:998:59: warning: incorrect type in argument 5 (different base types) net/mptcp/options.c:998:59: expected unsigned short [usertype] port net/mptcp/options.c:998:59: got restricted __be16 [usertype] port net/mptcp/options.c:1004:60: warning: incorrect type in argument 5 (different base types) net/mptcp/options.c:1004:60: expected unsigned short [usertype] port net/mptcp/options.c:1004:60: got restricted __be16 [usertype] port Before the mentioned commit, we were using port in u16 in mptcp_options_received, everything was OK. Signed-off-by: Matthieu Baerts --- net/mptcp/options.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/net/mptcp/options.c b/net/mptcp/options.c index 7fd40512df7f..43b85f2a5be1 100644 --- a/net/mptcp/options.c +++ b/net/mptcp/options.c @@ -248,7 +248,7 @@ static void mptcp_parse_option(const struct sk_buff *skb, ptr += 4; if (opsize == TCPOLEN_MPTCP_ADD_ADDR_PORT || opsize == TCPOLEN_MPTCP_ADD_ADDR_BASE_PORT) { - mp_opt->addr.port = get_unaligned_be16(ptr); + mp_opt->addr.port = cpu_to_be16(get_unaligned_be16(ptr)); ptr += 2; } } @@ -258,7 +258,7 @@ static void mptcp_parse_option(const struct sk_buff *skb, ptr += 16; if (opsize == TCPOLEN_MPTCP_ADD_ADDR6_PORT || opsize == TCPOLEN_MPTCP_ADD_ADDR6_BASE_PORT) { - mp_opt->addr.port = get_unaligned_be16(ptr); + mp_opt->addr.port = cpu_to_be16(get_unaligned_be16(ptr)); ptr += 2; } } @@ -995,13 +995,13 @@ static bool add_addr_hmac_valid(struct mptcp_sock *msk, hmac = add_addr_generate_hmac(msk->remote_key, msk->local_key, mp_opt->addr.id, &mp_opt->addr.addr, - mp_opt->addr.port); + be16_to_cpu(mp_opt->addr.port)); #if IS_ENABLED(CONFIG_MPTCP_IPV6) else hmac = add_addr6_generate_hmac(msk->remote_key, msk->local_key, mp_opt->addr.id, &mp_opt->addr.addr6, - mp_opt->addr.port); + be16_to_cpu(mp_opt->addr.port)); #endif pr_debug("msk=%p, ahmac=%llu, mp_opt->ahmac=%llu\n",