Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp922402ybl; Fri, 10 Jan 2020 08:58:52 -0800 (PST) X-Google-Smtp-Source: APXvYqy3E2VUdMXUz6MfKiBqBZHXHPLY4PqirYXPABYamYCoOC91Dd4lM0Kum7gIBpzo6AgpPjQ0 X-Received: by 2002:aca:36c1:: with SMTP id d184mr3041015oia.70.1578675532479; Fri, 10 Jan 2020 08:58:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578675532; cv=none; d=google.com; s=arc-20160816; b=McSK60jxRW0VPUHDvsTiLRVZZJfRDYs6yHuo4bmIQvT3o8orJ3AxpsrB6IW9+r8+pz Zl8UBrFDao92yE+s6lqFfaz8DAenLRWi01bP1KUpcbmV/I0y8spie4iyD4xQRkjCvnU1 K7lrfdPxNdMTY/mMPqnKVoov+Yct5x2YE4YDb2NxW9dPV8qggpm6+vSjOPSXDPzG1z9o veOmcaXPA/EjSxG+x1Sy8hodr+bdKFxw8Fr3nE9cEAJ/oWGtsunN88gZMk4CrpLJDnQ9 h5Vl6rP9dJoF2SET+GY/c1soesfLw31O6CjRUZ9o0TkETGyHjoa0J/qGDGiQGoPAeRbP GRCw== 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=HaTg3fbm+N7I7/3Je3Tr3h5rti8eXpU5ZxMI1AltzI0=; b=V5wb4mdxcaO7Y7CvBCLrYkIfD5RLKG0DBMncc2zHLTUVWKWE+6d92esx/s6fZYe3fd 6vHAaPKzMqFiFgIvhE/OXBfXIU+R+kAwXeF+OWC3vaSfCdm/bGOIOmNNGi1cgxUu58h2 LQlwecorfUW9gtXW+vQeJsYBkHTLIBZTVkd4Nm29Jotc3JVrkQfT2ELMvmsZbS2KEN2n 02RR9RfC6H46srLsxl2zWEK5cSZ1LDQ29/5+MVGa9fneqOM7wi4VBcNO3KkQYi3sNAxY bbxVbjZpzMYQGH2bTw3Tu12mjZ/ynF8dMDwUR2aHfsibQ5J4rsNB1vnnyH15OwypYwVN hwiw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=J+NQubrD; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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. [209.132.180.67]) by mx.google.com with ESMTP id q190si1494993oic.187.2020.01.10.08.58.41; Fri, 10 Jan 2020 08:58:52 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=J+NQubrD; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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 S1728645AbgAJQ4t (ORCPT + 99 others); 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