diff mbox

net: ipv6: Fix incompatible pointer type warning

Message ID 1370262068-16658-1-git-send-email-emilgoode@gmail.com
State Accepted, archived
Delegated to: David Miller
Headers show

Commit Message

Emil Goode June 3, 2013, 12:21 p.m. UTC
This fixes the sparse warning below about assignment from
incompatible pointer type.

In the following commit the third argument in function ipv6_chk_addr
was changed to const and struct nf_ipv6_ops was introduced with
the third argument of .chk_addr beeing const.

2a7851bffb008ff4882eee673da74718997b4265
("netfilter: add nf_ipv6_ops hook to fix xt_addrtype with IPv6")

The below commit introduced the warning as the third argument of
dummy_ipv6_chk_addr and .ipv6_chk_addr in struct pingv6_ops is
missing a const.

6d0bfe22611602f36617bc7aa2ffa1bbb2f54c67
("net: ipv6: Add IPv6 support to the ping socket.")

Sparse output:

net/ipv6/ping.c: In function ‘pingv6_init’:
net/ipv6/ping.c:87:27: warning:
	assignment from incompatible pointer type [enabled by default]

Signed-off-by: Emil Goode <emilgoode@gmail.com>
---
 include/net/ping.h |    2 +-
 net/ipv6/ping.c    |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

Comments

Lorenzo Colitti June 4, 2013, 9:34 a.m. UTC | #1
On Mon, Jun 3, 2013 at 9:21 PM, Emil Goode <emilgoode@gmail.com> wrote:
> This fixes the sparse warning below about assignment from
> incompatible pointer type.
>
> In the following commit the third argument in function ipv6_chk_addr
> was changed to const and struct nf_ipv6_ops was introduced with
> the third argument of .chk_addr beeing const.
>
> 2a7851bffb008ff4882eee673da74718997b4265
> ("netfilter: add nf_ipv6_ops hook to fix xt_addrtype with IPv6")
>
> The below commit introduced the warning as the third argument of
> dummy_ipv6_chk_addr and .ipv6_chk_addr in struct pingv6_ops is
> missing a const.
>
> 6d0bfe22611602f36617bc7aa2ffa1bbb2f54c67
> ("net: ipv6: Add IPv6 support to the ping socket.")
>
> Sparse output:
>
> net/ipv6/ping.c: In function ‘pingv6_init’:
> net/ipv6/ping.c:87:27: warning:
>         assignment from incompatible pointer type [enabled by default]
>
> Signed-off-by: Emil Goode <emilgoode@gmail.com>
> ---
>  include/net/ping.h |    2 +-
>  net/ipv6/ping.c    |    2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/include/net/ping.h b/include/net/ping.h
> index 9242fa0..2db4860 100644
> --- a/include/net/ping.h
> +++ b/include/net/ping.h
> @@ -38,7 +38,7 @@ struct pingv6_ops {
>         void (*ipv6_icmp_error)(struct sock *sk, struct sk_buff *skb, int err,
>                                 __be16 port, u32 info, u8 *payload);
>         int (*ipv6_chk_addr)(struct net *net, const struct in6_addr *addr,
> -                            struct net_device *dev, int strict);
> +                            const struct net_device *dev, int strict);
>  };
>
>  struct ping_table {
> diff --git a/net/ipv6/ping.c b/net/ipv6/ping.c
> index a6462d6..c2e9669 100644
> --- a/net/ipv6/ping.c
> +++ b/net/ipv6/ping.c
> @@ -73,7 +73,7 @@ int dummy_icmpv6_err_convert(u8 type, u8 code, int *err)
>  void dummy_ipv6_icmp_error(struct sock *sk, struct sk_buff *skb, int err,
>                             __be16 port, u32 info, u8 *payload) {}
>  int dummy_ipv6_chk_addr(struct net *net, const struct in6_addr *addr,
> -                       struct net_device *dev, int strict)
> +                       const struct net_device *dev, int strict)
>  {
>         return 0;
>  }
> --
> 1.7.10.4
>

Acked-by: Lorenzo Colitti <lorenzo@google.com>
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
David Miller June 5, 2013, 12:14 a.m. UTC | #2
From: Emil Goode <emilgoode@gmail.com>

Date: Mon,  3 Jun 2013 14:21:08 +0200

> This fixes the sparse warning below about assignment from

> incompatible pointer type.

> 

> In the following commit the third argument in function ipv6_chk_addr

> was changed to const and struct nf_ipv6_ops was introduced with

> the third argument of .chk_addr beeing const.

> 

> 2a7851bffb008ff4882eee673da74718997b4265

> ("netfilter: add nf_ipv6_ops hook to fix xt_addrtype with IPv6")

> 

> The below commit introduced the warning as the third argument of

> dummy_ipv6_chk_addr and .ipv6_chk_addr in struct pingv6_ops is

> missing a const.

> 

> 6d0bfe22611602f36617bc7aa2ffa1bbb2f54c67

> ("net: ipv6: Add IPv6 support to the ping socket.")

> 

> Sparse output:

> 

> net/ipv6/ping.c: In function ‘pingv6_init’:

> net/ipv6/ping.c:87:27: warning:

> 	assignment from incompatible pointer type [enabled by default]

> 

> Signed-off-by: Emil Goode <emilgoode@gmail.com>


This only happens when you combine net with net-next, therefore your
patch isn't actually relevent to any real GIT tree.

Please make this very clear in the future.
Emil Goode June 5, 2013, 10:23 a.m. UTC | #3
Hello David,

I'm sorry, the patch applies to the linux-next tree.
In the future I will be very careful about sending patches that fix
problems related to the merging of different trees.

Best regards,

Emil Goode

On Tue, Jun 04, 2013 at 05:14:56PM -0700, David Miller wrote:
> From: Emil Goode <emilgoode@gmail.com>
> Date: Mon,  3 Jun 2013 14:21:08 +0200
> 
> > This fixes the sparse warning below about assignment from
> > incompatible pointer type.
> > 
> > In the following commit the third argument in function ipv6_chk_addr
> > was changed to const and struct nf_ipv6_ops was introduced with
> > the third argument of .chk_addr beeing const.
> > 
> > 2a7851bffb008ff4882eee673da74718997b4265
> > ("netfilter: add nf_ipv6_ops hook to fix xt_addrtype with IPv6")
> > 
> > The below commit introduced the warning as the third argument of
> > dummy_ipv6_chk_addr and .ipv6_chk_addr in struct pingv6_ops is
> > missing a const.
> > 
> > 6d0bfe22611602f36617bc7aa2ffa1bbb2f54c67
> > ("net: ipv6: Add IPv6 support to the ping socket.")
> > 
> > Sparse output:
> > 
> > net/ipv6/ping.c: In function ‘pingv6_init’:
> > net/ipv6/ping.c:87:27: warning:
> > 	assignment from incompatible pointer type [enabled by default]
> > 
> > Signed-off-by: Emil Goode <emilgoode@gmail.com>
> 
> This only happens when you combine net with net-next, therefore your
> patch isn't actually relevent to any real GIT tree.
> 
> Please make this very clear in the future.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/include/net/ping.h b/include/net/ping.h
index 9242fa0..2db4860 100644
--- a/include/net/ping.h
+++ b/include/net/ping.h
@@ -38,7 +38,7 @@  struct pingv6_ops {
 	void (*ipv6_icmp_error)(struct sock *sk, struct sk_buff *skb, int err,
 				__be16 port, u32 info, u8 *payload);
 	int (*ipv6_chk_addr)(struct net *net, const struct in6_addr *addr,
-			     struct net_device *dev, int strict);
+			     const struct net_device *dev, int strict);
 };
 
 struct ping_table {
diff --git a/net/ipv6/ping.c b/net/ipv6/ping.c
index a6462d6..c2e9669 100644
--- a/net/ipv6/ping.c
+++ b/net/ipv6/ping.c
@@ -73,7 +73,7 @@  int dummy_icmpv6_err_convert(u8 type, u8 code, int *err)
 void dummy_ipv6_icmp_error(struct sock *sk, struct sk_buff *skb, int err,
 			    __be16 port, u32 info, u8 *payload) {}
 int dummy_ipv6_chk_addr(struct net *net, const struct in6_addr *addr,
-			struct net_device *dev, int strict)
+			const struct net_device *dev, int strict)
 {
 	return 0;
 }