From patchwork Mon Feb 22 16:25:44 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Jason A. Donenfeld" X-Patchwork-Id: 385810 Delivered-To: patch@linaro.org Received: by 2002:a02:290e:0:0:0:0:0 with SMTP id p14csp1418250jap; Mon, 22 Feb 2021 08:29:41 -0800 (PST) X-Google-Smtp-Source: ABdhPJy7/tN7ukGOs98lKYviYAoBWjdKgc6Qmpmwp7laLM5Mwqt58AsbqFEM5YWz78SB5fiPJ9Q6 X-Received: by 2002:a17:906:2790:: with SMTP id j16mr7254785ejc.420.1614011381678; Mon, 22 Feb 2021 08:29:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614011381; cv=none; d=google.com; s=arc-20160816; b=TSk8zhkmbesGw1uKmbv4JWGf4n6AqCT9ftbDrs1xzuuTmorDQmmMP1C7C8TsjZr2z/ ztLDip61seA6T0E9bAYSYlMVob9kSNXVVxb5tWZGmexHtrn30qHDxsCeilKw9TVxW4jn gx71ELAMnQS8tRasg1Xyzs0wG/EDs8wcPigfVyJ7OW/qiurVMEKZ2tslv+dS8Jv0yMx8 OYyuqZ97/U0UQT0Jk8RFTufyNzN9QkSBpXL2a3ZFzUj+Zh1DrKoJJ0895wWe8NYeL4Yr qlOye9navIZWDq++f8rv+iuQVjLAwq7/W53iQjPkDpoWuEaWB+EaHrd05fB5eJErqYUE kAQQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=Z+7fThJ1DMrd5h9xcT9hDeO3ALShvpQVzlOZ35I18cE=; b=yu0L1RDmEvbN6W4kvefriMYo5r96hnZkQM1V7VOl4XIb7mEgOzF4xgw4zRZXthY5Cx 7xHlo9Tu9h04HkvCypWMNrki/juTbeSkQTzqAeEEqUNXWmyM1lH36hDyc+QqOkomChQd hXMXxk84lE9tDpURzCESOlO3EyKUprdYF7KRZNfO/+rIyBxnS/wkX+zcvpNndu8QVsk0 yiLMLHT+19cwOFlxjlmQlu7kUETyOVR6lhKQ0t00suL2P0Mi8NWJ+0dONyZWoT4QfkFc 7Z5LC5f/rsuzhTQVjQ9CyPrHqj1VJMXkVqPQsPjcKttGtDO0du4prV3RWbsERSIsOzOG w7cQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@zx2c4.com header.s=20210105 header.b=cAMVFP9h; spf=pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=zx2c4.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ld19si11583137ejb.273.2021.02.22.08.29.41; Mon, 22 Feb 2021 08:29:41 -0800 (PST) Received-SPF: pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@zx2c4.com header.s=20210105 header.b=cAMVFP9h; spf=pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=zx2c4.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231261AbhBVQ2M (ORCPT + 9 others); Mon, 22 Feb 2021 11:28:12 -0500 Received: from mail.zx2c4.com ([104.131.123.232]:32820 "EHLO mail.zx2c4.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231700AbhBVQ1K (ORCPT ); Mon, 22 Feb 2021 11:27:10 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=zx2c4.com; s=20210105; t=1614011156; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Z+7fThJ1DMrd5h9xcT9hDeO3ALShvpQVzlOZ35I18cE=; b=cAMVFP9hhw2agLuASQkx2ygpW91a3hJGPMRjC8uRHNtxjWsMNX4OzL7web+0cXzhmYLmpW Fu7fqx4NApX2LuaIiPEKR4gfabSTn8DzEh56Qv32iEek9FEL0wQHxKmYwR30tZTOjUN5qH JKigkCbmQLAAIScZA6hg1v3MYjUHjNo= Received: by mail.zx2c4.com (ZX2C4 Mail Server) with ESMTPSA id 7e050274 (TLSv1.3:AEAD-AES256-GCM-SHA384:256:NO); Mon, 22 Feb 2021 16:25:56 +0000 (UTC) From: "Jason A. Donenfeld" To: netdev@vger.kernel.org, davem@davemloft.net Subject: [PATCH net 2/7] wireguard: socket: remove bogus __be32 annotation Date: Mon, 22 Feb 2021 17:25:44 +0100 Message-Id: <20210222162549.3252778-3-Jason@zx2c4.com> In-Reply-To: <20210222162549.3252778-1-Jason@zx2c4.com> References: <20210222162549.3252778-1-Jason@zx2c4.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Jann Horn The endpoint->src_if4 has nothing to do with fixed-endian numbers; remove the bogus annotation. This was introduced in https://git.zx2c4.com/wireguard-monolithic-historical/commit?id=14e7d0a499a676ec55176c0de2f9fcbd34074a82 in the historical WireGuard repo because the old code used to zero-initialize multiple members as follows: endpoint->src4.s_addr = endpoint->src_if4 = fl.saddr = 0; Because fl.saddr is fixed-endian and an assignment returns a value with the type of its left operand, this meant that sparse detected an assignment between values of different endianness. Since then, this assignment was already split up into separate statements; just the cast survived. Signed-off-by: Jann Horn Fixes: e7096c131e51 ("net: WireGuard secure network tunnel") Signed-off-by: Jason A. Donenfeld --- drivers/net/wireguard/socket.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- 2.30.1 diff --git a/drivers/net/wireguard/socket.c b/drivers/net/wireguard/socket.c index 41430c0e465a..d9ad850daa79 100644 --- a/drivers/net/wireguard/socket.c +++ b/drivers/net/wireguard/socket.c @@ -53,7 +53,7 @@ static int send4(struct wg_device *wg, struct sk_buff *skb, if (unlikely(!inet_confirm_addr(sock_net(sock), NULL, 0, fl.saddr, RT_SCOPE_HOST))) { endpoint->src4.s_addr = 0; - *(__force __be32 *)&endpoint->src_if4 = 0; + endpoint->src_if4 = 0; fl.saddr = 0; if (cache) dst_cache_reset(cache); @@ -63,7 +63,7 @@ static int send4(struct wg_device *wg, struct sk_buff *skb, PTR_ERR(rt) == -EINVAL) || (!IS_ERR(rt) && rt->dst.dev->ifindex != endpoint->src_if4)))) { endpoint->src4.s_addr = 0; - *(__force __be32 *)&endpoint->src_if4 = 0; + endpoint->src_if4 = 0; fl.saddr = 0; if (cache) dst_cache_reset(cache);