Skip to contentSkip to conversation

net: ipv6: Fix incompatible pointer type warning

PATCH In review Emil Goode 3 participants 4 messages Jun 3, 2013 – Jun 5, 2013

Subsystems (3)
lore
Share & tools
lore

Emil Goode

author
#0 lore raw

PATCH 1/1 net: ipv6: Fix incompatible pointer type warning

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]

---
 include/net/ping.h |    2 +-
 net/ipv6/ping.c    |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
include/net/ping.h +1 -1
index 9242fa0..2db4860 100644
@@ -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 {
net/ipv6/ping.c +1 -1
index a6462d6..c2e9669 100644
@@ -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;
 }
Signature · 1 line
1.7.10.4
Acked-by on v1 1/1
#1 lore raw
Quoted 56 lines · Emil Goode

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]

---
 include/net/ping.h |    2 +-
 net/ipv6/ping.c    |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
include/net/ping.h +1 -1
index 9242fa0..2db4860 100644
@@ -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 {
net/ipv6/ping.c +1 -2
index a6462d6..c2e9669 100644
@@ -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;
 }
--
Quoted 2 lines

1.7.10.4

--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

maintainer
#2 lore raw
In reply to Emil Goode

RnJvbTogRW1pbCBHb29kZSA8ZW1pbGdvb2RlQGdtYWlsLmNvbT4NCkRhdGU6IE1vbiwgIDMgSnVu IDI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iB3YXJuaW5nOg0KPiAJYXNz aWdubWVudCBmcm9tIGluY29tcGF0aWJsZSBwb2ludGVyIHR5cGUgW2VuYWJsZWQgYnkgZGVmYXVs dF0NCj4gDQo+IFNpZ25lZC1vZmYtYnk6IEVtaWwgR29vZGUgPGVtaWxnb29kZUBnbWFpbC5jb20+ DQoNClRoaXMgb25seSBoYXBwZW5zIHdoZW4geW91IGNvbWJpbmUgbmV0IHdpdGggbmV0LW5leHQs IHRoZXJlZm9yZSB5b3VyDQpwYXRjaCBpc24ndCBhY3R1YWxseSByZWxldmVudCB0byBhbnkgcmVh bCBHSVQgdHJlZS4NCg0KUGxlYXNlIG1ha2UgdGhpcyB2ZXJ5IGNsZWFyIGluIHRoZSBmdXR1cmUu DQo

author
#3 lore raw

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

Quoted 32 lines · David Miller

From: Emil Goode <[email protected]>
Date: Mon, 3 Jun 2013 14:21:08 +0200

Quoted 17 lines

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.")

Quoted 7 lines

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]

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.