Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp2766210ybk; Tue, 12 May 2020 07:39:31 -0700 (PDT) X-Google-Smtp-Source: APiQypLXdtL9l026ZcY2PzBH8p8BlzmLp0XErxJvES20wg5y5r+51iPP/obWwW8kRVYQpmos5Ja5 X-Received: by 2002:a17:906:804a:: with SMTP id x10mr18801949ejw.86.1589294371258; Tue, 12 May 2020 07:39:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589294371; cv=none; d=google.com; s=arc-20160816; b=Keq5KlBScB/A/VI9EPI5JNEeKqXMQHvcam27qCHQtMOhxEyDqWPfk/JKB1Xdm3F814 r1t+WBobrGT6i54fKkyvtGWYWAhcHGuJyFIdYbqXESNWX696AO7sZmS+XiejED2WhYbR csGdg15m9LhV3r6451SLdJviaQ0sWG0hFICm6nik6zqspKLWMDMNcZvZ/WuGxa43tBHx rDBpwVQ2gb5YwvcVPoUFc1o2qyrN1ukJTKuFmQEDDS8FxOQI+X/dQEY+MkJG0dxHMFY/ 49jPUAHHNNe9QhypeEDqsOImDwgk0lMdBo+40qwFPX+T3wqTrGHG6cmRafMwmvNjQg4c XYPQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :robot-unsubscribe:robot-id:message-id:mime-version:references :in-reply-to:cc:subject:to:reply-to:from:date; bh=+INF8d+oSA7xUhhwkdh9zT/sKUgA0tvXVL4KzsUpz74=; b=RdFgtlLGII0Z9PoPmTWkrX60tRyFJvuJBueklDxtE/CGNa8OuO8GZyIbAoLSsYdwBR bL4GopEqEUOVWh7EHLeUv0WxBbWBUznlUWalWRY7v7LwWBFMHgTnIKPVbYxneJIF1GYU j7K15xFwMzjZdaAftI23ymGHQSiRfBdRtdszScammL0ju7RfepX7Xp8bzuH6DIG86Xlj sJN+Dus/q6Bu1bT9y+/vE6tFbW8CBDRDRGeEy6F1gdDR2EGCMLlkP//SFgnL9N6RB7AB jtp14X8gRydI3i6ZJf+PBuG00s990SBplMnXcicEOkNGrd46Ue1+DmvD45Vy/3DmorM3 KT0Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bo4si825343ejb.158.2020.05.12.07.39.07; Tue, 12 May 2020 07:39:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730471AbgELOh3 convert rfc822-to-8bit (ORCPT + 99 others); Tue, 12 May 2020 10:37:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39432 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730425AbgELOhP (ORCPT ); Tue, 12 May 2020 10:37:15 -0400 Received: from Galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2B6CAC061A0C; Tue, 12 May 2020 07:37:15 -0700 (PDT) Received: from [5.158.153.53] (helo=tip-bot2.lab.linutronix.de) by Galois.linutronix.de with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1jYW1i-0005pb-RP; Tue, 12 May 2020 16:36:59 +0200 Received: from [127.0.1.1] (localhost [IPv6:::1]) by tip-bot2.lab.linutronix.de (Postfix) with ESMTP id 721C51C0475; Tue, 12 May 2020 16:36:58 +0200 (CEST) Date: Tue, 12 May 2020 14:36:58 -0000 From: "tip-bot2 for Will Deacon" Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: locking/kcsan] netfilter: Avoid assigning 'const' pointer to non-const pointer Cc: Will Deacon , Thomas Gleixner , Nick Desaulniers , "Peter Zijlstra (Intel)" , Pablo Neira Ayuso , Jozsef Kadlecsik , Florian Westphal , "David S. Miller" , x86 , LKML In-Reply-To: <20200511204150.27858-7-will@kernel.org> References: <20200511204150.27858-7-will@kernel.org> MIME-Version: 1.0 Message-ID: <158929421838.390.13439322352109881034.tip-bot2@tip-bot2> X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8BIT X-Linutronix-Spam-Score: -1.0 X-Linutronix-Spam-Level: - X-Linutronix-Spam-Status: No , -1.0 points, 5.0 required, ALL_TRUSTED=-1,SHORTCIRCUIT=-0.0001 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The following commit has been merged into the locking/kcsan branch of tip: Commit-ID: f64554152014597a40403ea1a291c80785a2dfe9 Gitweb: https://git.kernel.org/tip/f64554152014597a40403ea1a291c80785a2dfe9 Author: Will Deacon AuthorDate: Mon, 11 May 2020 21:41:38 +01:00 Committer: Thomas Gleixner CommitterDate: Tue, 12 May 2020 11:04:11 +02:00 netfilter: Avoid assigning 'const' pointer to non-const pointer 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. Signed-off-by: Will Deacon Signed-off-by: Thomas Gleixner Reviewed-by: Nick Desaulniers Acked-by: Peter Zijlstra (Intel) Cc: Pablo Neira Ayuso Cc: Jozsef Kadlecsik Cc: Florian Westphal Cc: "David S. Miller" Link: https://lkml.kernel.org/r/20200511204150.27858-7-will@kernel.org --- 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 78f046e..3ac7c8c 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; }