From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.1 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id EB74FC282DD for ; Fri, 10 Jan 2020 16:56:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C0D6A20838 for ; Fri, 10 Jan 2020 16:56:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578675410; bh=/lYMq0JqP8OeZRaU/WM90KSExsE7RBJ5EeIQqcP4Pmw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=FCxXGAAVV15Glyq5oFQrAxU8+WVCypPHiqSCcpNziGeBuuOgKWFc4hkeGmZQu8CYQ 50a3tQlN/GQ9Ecse7cPS1rPwC7YIMHCl/gvcBrs86ltMX/+Q8+2/9ezwgf/WHs1JDP QVEoQGErs5L2+TgNA8KT8Mlp/v7IgPyItRwrGrx0= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728650AbgAJQ4t (ORCPT ); Fri, 10 Jan 2020 11:56:49 -0500 Received: from mail.kernel.org ([198.145.29.99]:60006 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728594AbgAJQ4s (ORCPT ); Fri, 10 Jan 2020 11:56:48 -0500 Received: from localhost.localdomain (236.31.169.217.in-addr.arpa [217.169.31.236]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 0C8C22072A; Fri, 10 Jan 2020 16:56:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578675407; bh=/lYMq0JqP8OeZRaU/WM90KSExsE7RBJ5EeIQqcP4Pmw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=J+NQubrDjXRMazgVYGd2Z2R1HoFewGZPtMFIoLRcRKltYVXrKIvC+6jrp6sYIagLi WZOQ+9H7XO2q1t3BdG7aVMj43ttWZLdbKnVH+JcAI4p8L1iabHzteiV1G7BvKlsEOv AAfnohVloSVDEQvGgCd19odi8uDbEHspigNkyGgg= From: Will Deacon To: linux-kernel@vger.kernel.org Cc: linux-arch@vger.kernel.org, kernel-team@android.com, Will Deacon , Michael Ellerman , Peter Zijlstra , Linus Torvalds , Segher Boessenkool , Christian Borntraeger , Luc Van Oostenryck , Arnd Bergmann , Pablo Neira Ayuso , Jozsef Kadlecsik , Florian Westphal , "David S. Miller" Subject: [RFC PATCH 2/8] netfilter: Avoid assigning 'const' pointer to non-const pointer Date: Fri, 10 Jan 2020 16:56:30 +0000 Message-Id: <20200110165636.28035-3-will@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200110165636.28035-1-will@kernel.org> References: <20200110165636.28035-1-will@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org nf_remove_net_hook() uses WRITE_ONCE() to assign a 'const pointer to a 'non-const' pointer. Cleanups to the implementation of WRITE_ONCE() mean that this will give rise to a compiler warning, just like a plain old assignment would do: | In file included from ./include/linux/export.h:43, | from ./include/linux/linkage.h:7, | from ./include/linux/kernel.h:8, | from net/netfilter/core.c:9: | net/netfilter/core.c: In function ‘nf_remove_net_hook’: | ./include/linux/compiler.h:216:30: warning: assignment discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers] | *(volatile typeof(x) *)&(x) = (val); \ | ^ | net/netfilter/core.c:379:3: note: in expansion of macro ‘WRITE_ONCE’ | WRITE_ONCE(orig_ops[i], &dummy_ops); | ^~~~~~~~~~ Follow the pattern used elsewhere in this file and add a cast to 'void *' to squash the warning. Cc: Pablo Neira Ayuso Cc: Jozsef Kadlecsik Cc: Florian Westphal Cc: "David S. Miller" Signed-off-by: Will Deacon --- net/netfilter/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/netfilter/core.c b/net/netfilter/core.c index 78f046ec506f..3ac7c8c1548d 100644 --- a/net/netfilter/core.c +++ b/net/netfilter/core.c @@ -376,7 +376,7 @@ static bool nf_remove_net_hook(struct nf_hook_entries *old, if (orig_ops[i] != unreg) continue; WRITE_ONCE(old->hooks[i].hook, accept_all); - WRITE_ONCE(orig_ops[i], &dummy_ops); + WRITE_ONCE(orig_ops[i], (void *)&dummy_ops); return true; } -- 2.25.0.rc1.283.g88dfdc4193-goog