From patchwork Tue Oct 25 23:03:25 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Gunthorpe X-Patchwork-Id: 686796 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3t3TGw5LyLz9srZ for ; Wed, 26 Oct 2016 10:03:52 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=obsidianresearch.com header.i=@obsidianresearch.com header.b=XXOmAOXX; dkim-atps=neutral Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755457AbcJYXD3 (ORCPT ); Tue, 25 Oct 2016 19:03:29 -0400 Received: from quartz.orcorp.ca ([184.70.90.242]:42201 "EHLO quartz.orcorp.ca" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754120AbcJYXD2 (ORCPT ); Tue, 25 Oct 2016 19:03:28 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=obsidianresearch.com; s=rsa1; h=Content-Type:MIME-Version:Message-ID:Subject:Cc:To:From:Date; bh=R8yMZ2V137trjTOZU632ohAdgqVPIXO3judy8Wb5T+s=; b=XXOmAOXXptuSahMAMpvk7a9KqOBphdWJzZUckcrQJGYpkKFqS02+G7xB1XKOgDMaj9WyeQOI4adaZd5rIwc3Nlqpo098b2N4Yb3DxrZ9Khm92W84SKPkCKUFr9wjSsGx1+Z1B9i7rSt2XndxCis5ncTrkF3EbyP01WC14wcEQ5w=; Received: from [10.0.0.151] (helo=jggl.edm.orcorp.ca) by quartz.orcorp.ca with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1bzAkg-0000Nj-2T; Tue, 25 Oct 2016 17:03:26 -0600 Received: from jgg by jggl.edm.orcorp.ca with local (Exim 4.84) (envelope-from ) id 1bzAkf-00046g-Qb; Tue, 25 Oct 2016 17:03:25 -0600 Date: Tue, 25 Oct 2016 17:03:25 -0600 From: Jason Gunthorpe To: netdev@vger.kernel.org Cc: davem@davemloft.net, linux-kernel@vger.kernel.org Subject: [PATCH] uapi: Fix userspace compilation of ip_tables.h/ip6_tables.h in C++ mode Message-ID: <20161025230325.GA14955@obsidianresearch.com> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.23 (2014-03-12) X-Broken-Reverse-DNS: no host name found for IP address 10.0.0.151 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org The implicit cast from void * is not allowed for C++ compilers, and the arithmetic on void * generates warnings if a C++ application tries to include these UAPI headers. $ g++ -c t.cc ip_tables.h:221:24: warning: pointer of type 'void *' used in arithmetic ip_tables.h:221:24: error: invalid conversion from 'void*' to 'xt_entry_target*' Signed-off-by: Jason Gunthorpe --- include/uapi/linux/netfilter_ipv4/ip_tables.h | 2 +- include/uapi/linux/netfilter_ipv6/ip6_tables.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/include/uapi/linux/netfilter_ipv4/ip_tables.h b/include/uapi/linux/netfilter_ipv4/ip_tables.h index d0da53d96d93..4682b18f3f44 100644 --- a/include/uapi/linux/netfilter_ipv4/ip_tables.h +++ b/include/uapi/linux/netfilter_ipv4/ip_tables.h @@ -221,7 +221,7 @@ struct ipt_get_entries { static __inline__ struct xt_entry_target * ipt_get_target(struct ipt_entry *e) { - return (void *)e + e->target_offset; + return (struct xt_entry_target *)((__u8 *)e + e->target_offset); } /* diff --git a/include/uapi/linux/netfilter_ipv6/ip6_tables.h b/include/uapi/linux/netfilter_ipv6/ip6_tables.h index d1b22653daf2..05e0631a6d12 100644 --- a/include/uapi/linux/netfilter_ipv6/ip6_tables.h +++ b/include/uapi/linux/netfilter_ipv6/ip6_tables.h @@ -261,7 +261,7 @@ struct ip6t_get_entries { static __inline__ struct xt_entry_target * ip6t_get_target(struct ip6t_entry *e) { - return (void *)e + e->target_offset; + return (struct xt_entry_target *)((__u8 *)e + e->target_offset); } /*