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 4A5FBC2D0DB for ; Thu, 23 Jan 2020 15:34:00 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 2010D21D7E for ; Thu, 23 Jan 2020 15:34:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1579793640; bh=DgeBHk4Qi142J8t70WZY/HkMLE2nSKCOiVg2mhluDAA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=1AEufxLIjl2HpWsh8ijDBj/lM0OfmA2UF5288p0CoKb/g0i3VT4aLBoDtNXR+gyCx dp19IgRXs+yspCvjcgQ3g2GlrkoxC77Ig3RRlsnc11GD9twVsVZwEMaQWI+tmUvMrF OSV7hdIpiGftu67SjGBDz7jc/aAQviEddNCfymP8= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729083AbgAWPd7 (ORCPT ); Thu, 23 Jan 2020 10:33:59 -0500 Received: from mail.kernel.org ([198.145.29.99]:51582 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726232AbgAWPd5 (ORCPT ); Thu, 23 Jan 2020 10:33:57 -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 52F5822464; Thu, 23 Jan 2020 15:33:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1579793637; bh=DgeBHk4Qi142J8t70WZY/HkMLE2nSKCOiVg2mhluDAA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=M6/axnAUs1mhPEjyqMeyg+I5Pj8EQNwg5B+uk4ZfXL5TY2q4jDg+VrcwUWzZLmDT5 oCXleHNonKqhqcLTy2bExX00I/WM7fyOctbBfwIPbaIFTb1+3ZSW8yXwpyw43FANnk IocGwe21GDoaaWvL8ogZPYCmoq3LMlFnEqOoFMvE= 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 , Peter Oberparleiter , Masahiro Yamada , Nick Desaulniers , Pablo Neira Ayuso , Jozsef Kadlecsik , Florian Westphal , "David S. Miller" Subject: [PATCH v2 02/10] netfilter: Avoid assigning 'const' pointer to non-const pointer Date: Thu, 23 Jan 2020 15:33:33 +0000 Message-Id: <20200123153341.19947-3-will@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200123153341.19947-1-will@kernel.org> References: <20200123153341.19947-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.341.g760bfbb309-goog