From patchwork Fri May 14 10:00:59 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 438830 Delivered-To: patch@linaro.org Received: by 2002:a02:b78d:0:0:0:0:0 with SMTP id f13csp193235jam; Fri, 14 May 2021 03:05:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw8NzTSRzjEpogIux5Gq3uvIcTDq2PbuKLVxR0WTTqFJBuVao7QnrSZHv9QFwEROeAvRmAF X-Received: by 2002:a92:c5c5:: with SMTP id s5mr9439703ilt.249.1620986712720; Fri, 14 May 2021 03:05:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620986712; cv=none; d=google.com; s=arc-20160816; b=Ivsty87ZlvNKnnZAiVFJdJDwNMw1EfcYIHUmUQhFXT1kUMC9dVZgpbXMJse8ieBD5k kiNbgMwRQxRIP8+umvMxqC7rh5pqp6WVwr/UXdjkMaBM5wibbGSNqVQTvIL9576+yXSi xSnad4qneYbd7fRhQMVqwmfpYunBONEma9Hh1mGjfXh4FmdwOGA2e7NRdbFepdeThq5E /e8f26kRKm+C6PK1Glvjj38en8/DP8YfPMhweJQH8c1V8+Ku0Pvrmdot2A0oxfflP7o5 PlO6To+q9eWmznQHXCqPi4lOGYJqCz9uVfvB+6mP/DufBmTewIgER1m6lf4BJk3+zc5O NImQ== 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=JojbaVM3LARGGm6lZvgOxRJMusnIMyyppgh94gwfwjs5ICwwCE5FI9TDT8QPDgUY9F 97OLOCGjJBnO2Fx8T9Mxfdkt6PfTFtJXq/KThVVeeQIOv70aZNThSLG2+2PnvWmhqawl hpJwbv91W2QiNq2+3eUdur5gqBdSCrhAu7l8cbb4VYdA9jH01s4HAUPf+2VOkvz6LJOl SCh/6Y7g5eSYADhymn5iUb76CydPOFaxuJ5Yy+cfgXSYcBfNgfDPEcJPxKKj0pCcETBp iijFBovO2n5HVdvuWVt3QC1ttZxTSER8XoUVxQI44AwfXxVfwCwPlhMwkMlkzvSeDQ3w bwRg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=gmhKJJL5; 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 e194si7272077iof.53.2021.05.14.03.05.12; Fri, 14 May 2021 03:05:12 -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=gmhKJJL5; 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 S233944AbhENKGR (ORCPT + 8 others); Fri, 14 May 2021 06:06:17 -0400 Received: from mail.kernel.org ([198.145.29.99]:59970 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233976AbhENKGI (ORCPT ); Fri, 14 May 2021 06:06:08 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id B44506101D; Fri, 14 May 2021 10:04:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1620986696; bh=+A8VF6/YLLVZtHfI0InfFULYrSxtxYtufbUrU8xRDtk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gmhKJJL5SXQjQHnTSGgQ2PjxnGS+rwWSAS3V/Z/ffTc9JenAPf10igkOoMsjVN2Rb e5mST0FjQNa+/WQs2dSiN4FdAejisks0FgWfOrG/AcT3ImFcuomEpazmDe677XdvOz mQm3c49fFcei1qSN14KkY1AjMAhOjkFWKdxewjc1CurH3IXjf4iSvJY52Fmf9e6QSZ 0KiesqlzEeTUXEQIPrZjo/C6Y6x5/OesVx20g8jImzwBziM/K8oz7yyA0lZ1gMiXvO zL7ucIYZVeODSqj5GMsB82HFn3YUj6U7NioxAmfJ7JafuH/EvqiIQZ0dTWzLkVyEuD cLidUnIE5ceUQ== From: Arnd Bergmann To: linux-arch@vger.kernel.org Cc: Linus Torvalds , Vineet Gupta , Arnd Bergmann , "David S. Miller" , Jakub Kicinski , Florian Fainelli , Andrew Lunn , Vladimir Oltean , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 11/13] netpoll: avoid put_unaligned() on single character Date: Fri, 14 May 2021 12:00:59 +0200 Message-Id: <20210514100106.3404011-12-arnd@kernel.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210514100106.3404011-1-arnd@kernel.org> References: <20210514100106.3404011-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));