Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp2170293ybk; Mon, 11 May 2020 13:48:20 -0700 (PDT) X-Google-Smtp-Source: APiQypLGOV/lgXTNtDH4pjAgG9+eREQ3NVnRY4fa+WXGWSiiZOniFnID7iQAKVaLJW22a8rb2gU9 X-Received: by 2002:a17:907:214f:: with SMTP id rk15mr15295663ejb.301.1589230100220; Mon, 11 May 2020 13:48:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589230100; cv=none; d=google.com; s=arc-20160816; b=f0FIvbrMo+uLWNrvmzzWKBmLSQ4dhvABinZ8nwvu4VDavm6lSFFg5Uv67q6ukYbrG8 joE/2XHVjnUYHjNa3uYehUkbTyUv31dJl4sUh8L9TvqsagMwNPdPddhY6KtdCRian7/r ohmPP2xSpH1TIXmPwTQmS5CifM+C9KWbEUiMY2Ay933rLKGOS7/QY2D30I5SJHCdhZ3j 8EQQIEMeEoAxPb6JG+tMCiftAg4zuxB5SUzJxrBps+kBMZqxTQVCrcq3rFnWSXpjWuvZ rh6XgxRwtfXV/Y1JS81+VpvIeHBp/nfTznIZ3IchulbyFLy2m+JnYluq8jXqox5d0cqZ GEZw== 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:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=WasQnTVnxP/cTEo7/K3BNkofFlfC6a3ekrMR3VPnals=; b=QPmM4jnZ5Cp2LjvHegjSkndQzShChs5s6Y85t/StoLicaqqWfEdhd34NrxRc40eAHW zYkppjLANNveVpaUJHflzYpyqDB8cmjMs5hQNuiwOn1SHZFPgKZdUkh/STLrD3TmU2Pp oubvRVsMGVCeKEf0rl4BKL1XsPIK0OkH+63fJs+Ce5uR0xSZ/V5iYoTMbg6MQpYUWUze bipodRJ9YV6VzKWmqlytQq42/qbEfK1HOLEv4tkGXi3mo8Athznim+aTAJaG14ebDyMQ prHR9mJHFsh0C52APZDXAaxJXu6rrrqGD98iiTwnEKhVd4GeolII+qeZANm4ka0NIWIW 2A3g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=VlV7joy+; 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; 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 cm18si6446281edb.130.2020.05.11.13.47.57; Mon, 11 May 2020 13:48:20 -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; dkim=pass header.i=@kernel.org header.s=default header.b=VlV7joy+; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731827AbgEKUmo (ORCPT + 99 others); Mon, 11 May 2020 16:42:44 -0400 Received: from mail.kernel.org ([198.145.29.99]:54254 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731777AbgEKUmn (ORCPT ); Mon, 11 May 2020 16:42:43 -0400 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 319272075E; Mon, 11 May 2020 20:42:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1589229762; bh=POJB7hnN0/xvBNfrkIDdkd6mL5J51lim3zkfStZEOBM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VlV7joy+2Ygogi5xWG0s9p5ILPVEYiZ0YDnLE4ECq657fIFvcj5weOmPVAnOl4AxD CiTjwQyaHAcObJCiv3cf/CgCyHs3umbN6yRWFJNP8oQma0Wi9iCFdP1awMchZcvnnx 9AhtIP7aZVZHSE0QxmJSBGTOMREwv1IWzxVgxsJY= From: Will Deacon To: linux-kernel@vger.kernel.org Cc: elver@google.com, tglx@linutronix.de, paulmck@kernel.org, mingo@kernel.org, peterz@infradead.org, will@kernel.org Subject: [PATCH v5 06/18] netfilter: Avoid assigning 'const' pointer to non-const pointer Date: Mon, 11 May 2020 21:41:38 +0100 Message-Id: <20200511204150.27858-7-will@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200511204150.27858-1-will@kernel.org> References: <20200511204150.27858-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" Reviewed-by: Nick Desaulniers 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.26.2.645.ge9eca65c58-goog