From patchwork Fri May 7 22:07:56 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 432149 Delivered-To: patch@linaro.org Received: by 2002:a02:c901:0:0:0:0:0 with SMTP id t1csp704983jao; Fri, 7 May 2021 15:12:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyUUX4ucCUxUioScpvFdnl/XgaxxV0/i/n6+VoYa1XqBWYooBJmI9kp/tVmbU2QFQyGkEOm X-Received: by 2002:a17:906:1f88:: with SMTP id t8mr12213531ejr.383.1620425522688; Fri, 07 May 2021 15:12:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620425522; cv=none; d=google.com; s=arc-20160816; b=uzNayioIRyXrG6pfcS9uN1m8DOMjmS82XOXYdaNVTUgS83B76+mJ2wXcrp2qdEIu7R PxbPxfxwRFuif/pILj0R/PLqHznqD8OV0zQPoNGjospY6ICg8cDvy1dGVjJfzop2wjbP E0uj2Wn0xw226hQYzAyQyVnV9YqmPczw00KT7d1eSOLLpVR8y5Jq3N7Ykth7GjMO/mK1 Do9bCerBraEq51bnJkB1N98u9LPnX8RznW7001eGuGSjJZxoDJJNAHK0u4n9a22JxEV7 C+CFZdbERFMBigjaBHepi15tNfWslrvCdpgFkmauCS+SFOaWCoMQL7s/DrpfVi2bugT8 Tw9Q== 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:cc:to:from :dkim-signature; bh=7pdVna7O/j22KzOpYce1Gtt0NM4bOX24sy2w9iiioq4=; b=gqM3cYVFg4loaLKPr5oDmwuIFvXvcw3Uok5ZH8qt/hC0NxeYrAC92OysuH/pv3uDwP +YVYz0pw4j9yN91wOJMP/ECWpEIspwidjF8U9n6zcADGAWgYX8kVOG0ur9MMIMrDH2ZW H9J781xQ0dm+4As7sCgD/8hxzO2edeMbq9wOKCvguEfGuplQYuqjigiYx0XbjF94/bZ7 WqOr4D4e6YiBr5vTx5d5exja4sugYI+IermjgjPk582e4wuUReiU/IuetcHA6nCZHTLI MSdQoOdZm4fnSjYhgpVu0LUMQBRK//hnPAGkhe6CE+UkgDqmzRjueocmAYK1J0alFkqh FLnw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=hlyJjwh7; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id rh9si4139239ejb.139.2021.05.07.15.12.02; Fri, 07 May 2021 15:12:02 -0700 (PDT) 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=@kernel.org header.s=k20201202 header.b=hlyJjwh7; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229778AbhEGWNA (ORCPT + 8 others); Fri, 7 May 2021 18:13:00 -0400 Received: from mail.kernel.org ([198.145.29.99]:59474 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230113AbhEGWMv (ORCPT ); Fri, 7 May 2021 18:12:51 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 0872461157; Fri, 7 May 2021 22:11:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1620425511; bh=+A8VF6/YLLVZtHfI0InfFULYrSxtxYtufbUrU8xRDtk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hlyJjwh7qEunOffqjOOGVduvXwgOaykl4KDohI1T/8pwMkkdix/3dNtEz55QF9OnG 0G/zTpIKdgYUHq12Pbekj+ENDpO2lV6OiN5Zuu2FW3G0IFmZ2UhMKNX+pR13k+rTiG vY/N+FAUxj0bTXw+RJRHQL1hqL5v0+gONh8hesc8GEFSVI1ALm7dQfyoEFHQDNcIVm ksIir3wRy5KjZFPPcVLQKf1zvJcJq6v19QGtjPEYaHuCBbAkendeuAXgbjmMR8Bimi WMx2HhaQSgpCPEzb08BbbodutFA/4EJcOet7MRqvr5aEPvAUZyMTAWrTYMZ/sevaya gDW2W157/Whjg== From: Arnd Bergmann To: linux-arch@vger.kernel.org Cc: Linus Torvalds , Vineet Gupta , Arnd Bergmann , "David S. Miller" , Jakub Kicinski , Eric Dumazet , Florian Fainelli , Vladimir Oltean , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [RFC 11/12] netpoll: avoid put_unaligned() on single character Date: Sat, 8 May 2021 00:07:56 +0200 Message-Id: <20210507220813.365382-12-arnd@kernel.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210507220813.365382-1-arnd@kernel.org> References: <20210507220813.365382-1-arnd@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Arnd Bergmann With a planned cleanup, using put_unaligned() on a single character results in a harmless warning: In file included from ./arch/x86/include/generated/asm/unaligned.h:1, from include/linux/etherdevice.h:24, from net/core/netpoll.c:18: net/core/netpoll.c: In function 'netpoll_send_udp': include/asm-generic/unaligned.h:23:9: error: 'packed' attribute ignored for field of type 'unsigned char' [-Werror=attributes] net/core/netpoll.c:431:3: note: in expansion of macro 'put_unaligned' 431 | put_unaligned(0x60, (unsigned char *)ip6h); | ^~~~~~~~~~~~~ include/asm-generic/unaligned.h:23:9: error: 'packed' attribute ignored for field of type 'unsigned char' [-Werror=attributes] net/core/netpoll.c:459:3: note: in expansion of macro 'put_unaligned' 459 | put_unaligned(0x45, (unsigned char *)iph); | ^~~~~~~~~~~~~ Replace this with an open-coded pointer dereference. Signed-off-by: Arnd Bergmann --- net/core/netpoll.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- 2.29.2 diff --git a/net/core/netpoll.c b/net/core/netpoll.c index c310c7c1cef7..9c49a38fa315 100644 --- a/net/core/netpoll.c +++ b/net/core/netpoll.c @@ -428,7 +428,7 @@ void netpoll_send_udp(struct netpoll *np, const char *msg, int len) ip6h = ipv6_hdr(skb); /* ip6h->version = 6; ip6h->priority = 0; */ - put_unaligned(0x60, (unsigned char *)ip6h); + *(unsigned char *)ip6h = 0x60; ip6h->flow_lbl[0] = 0; ip6h->flow_lbl[1] = 0; ip6h->flow_lbl[2] = 0; @@ -456,7 +456,7 @@ void netpoll_send_udp(struct netpoll *np, const char *msg, int len) iph = ip_hdr(skb); /* iph->version = 4; iph->ihl = 5; */ - put_unaligned(0x45, (unsigned char *)iph); + *(unsigned char *)iph = 0x45; iph->tos = 0; put_unaligned(htons(ip_len), &(iph->tot_len)); iph->id = htons(atomic_inc_return(&ip_ident));