netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/1] vxlan: make the struct nlattr variable const
@ 2016-09-03 14:07 zyjzyj2000
  2016-09-04 12:27 ` Jiri Benc
  0 siblings, 1 reply; 2+ messages in thread
From: zyjzyj2000 @ 2016-09-03 14:07 UTC (permalink / raw)
  To: netdev, pabeni, daniel, pshelar, aduyck, hannes, jbenc, davem,
	zyjzyj2000

From: Zhu Yanjun <zyjzyj2000@gmail.com>

The struct nlattr variable should not be changed.

Signed-off-by: Zhu Yanjun <zyjzyj2000@gmail.com>
---
 drivers/net/vxlan.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c
index f605a36..ce65897 100644
--- a/drivers/net/vxlan.c
+++ b/drivers/net/vxlan.c
@@ -115,7 +115,7 @@ static inline bool vxlan_addr_multicast(const union vxlan_addr *ipa)
 		return IN_MULTICAST(ntohl(ipa->sin.sin_addr.s_addr));
 }
 
-static int vxlan_nla_get_addr(union vxlan_addr *ip, struct nlattr *nla)
+static int vxlan_nla_get_addr(union vxlan_addr *ip, const struct nlattr *nla)
 {
 	if (nla_len(nla) >= sizeof(struct in6_addr)) {
 		ip->sin6.sin6_addr = nla_get_in6_addr(nla);
@@ -157,7 +157,7 @@ static inline bool vxlan_addr_multicast(const union vxlan_addr *ipa)
 	return IN_MULTICAST(ntohl(ipa->sin.sin_addr.s_addr));
 }
 
-static int vxlan_nla_get_addr(union vxlan_addr *ip, struct nlattr *nla)
+static int vxlan_nla_get_addr(union vxlan_addr *ip, const struct nlattr *nla)
 {
 	if (nla_len(nla) >= sizeof(struct in6_addr)) {
 		return -EAFNOSUPPORT;
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH 1/1] vxlan: make the struct nlattr variable const
  2016-09-03 14:07 [PATCH 1/1] vxlan: make the struct nlattr variable const zyjzyj2000
@ 2016-09-04 12:27 ` Jiri Benc
  0 siblings, 0 replies; 2+ messages in thread
From: Jiri Benc @ 2016-09-04 12:27 UTC (permalink / raw)
  To: zyjzyj2000; +Cc: netdev, pabeni, daniel, pshelar, aduyck, hannes, davem

On Sat,  3 Sep 2016 22:07:10 +0800, zyjzyj2000@gmail.com wrote:
> From: Zhu Yanjun <zyjzyj2000@gmail.com>
> 
> The struct nlattr variable should not be changed.

True. But the only caller is vxlan_fdb_parse which doesn't have its tb
parameter const, so what's the point?

Now, the tb parameter of vxlan_fdb_parse could be changed to const.
This again doesn't make much sense without modifying its callers, which
are vxlan_fdb_add and vxlan_fdb_delete. And those are net_device_ops
hooks. Have you considered looking into those (ndo_fdb_*) and turning
the struct nlattr ** to const (that is, if it's possible)?

 Jiri

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-09-04 12:27 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-09-03 14:07 [PATCH 1/1] vxlan: make the struct nlattr variable const zyjzyj2000
2016-09-04 12:27 ` Jiri Benc

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).