Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[NETLINK]: Mark netlink policies const

Signed-off-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Patrick McHardy and committed by
David S. Miller
ef7c79ed 14a49e1f

+28 -28
+1 -1
include/net/fib_rules.h
··· 64 64 void (*flush_cache)(void); 65 65 66 66 int nlgroup; 67 - struct nla_policy *policy; 67 + const struct nla_policy *policy; 68 68 struct list_head *rules_list; 69 69 struct module *owner; 70 70 };
+1 -1
include/net/genetlink.h
··· 60 60 { 61 61 u8 cmd; 62 62 unsigned int flags; 63 - struct nla_policy *policy; 63 + const struct nla_policy *policy; 64 64 int (*doit)(struct sk_buff *skb, 65 65 struct genl_info *info); 66 66 int (*dumpit)(struct sk_buff *skb,
+1 -1
include/net/ip_fib.h
··· 213 213 #endif /* CONFIG_IP_MULTIPLE_TABLES */ 214 214 215 215 /* Exported by fib_frontend.c */ 216 - extern struct nla_policy rtm_ipv4_policy[]; 216 + extern const struct nla_policy rtm_ipv4_policy[]; 217 217 extern void ip_fib_init(void); 218 218 extern int fib_validate_source(__be32 src, __be32 dst, u8 tos, int oif, 219 219 struct net_device *dev, __be32 *spec_dst, u32 *itag);
+6 -6
include/net/netlink.h
··· 222 222 gfp_t flags); 223 223 224 224 extern int nla_validate(struct nlattr *head, int len, int maxtype, 225 - struct nla_policy *policy); 225 + const struct nla_policy *policy); 226 226 extern int nla_parse(struct nlattr *tb[], int maxtype, 227 227 struct nlattr *head, int len, 228 - struct nla_policy *policy); 228 + const struct nla_policy *policy); 229 229 extern struct nlattr * nla_find(struct nlattr *head, int len, int attrtype); 230 230 extern size_t nla_strlcpy(char *dst, const struct nlattr *nla, 231 231 size_t dstsize); ··· 360 360 */ 361 361 static inline int nlmsg_parse(struct nlmsghdr *nlh, int hdrlen, 362 362 struct nlattr *tb[], int maxtype, 363 - struct nla_policy *policy) 363 + const struct nla_policy *policy) 364 364 { 365 365 if (nlh->nlmsg_len < nlmsg_msg_size(hdrlen)) 366 366 return -EINVAL; ··· 392 392 * @policy: validation policy 393 393 */ 394 394 static inline int nlmsg_validate(struct nlmsghdr *nlh, int hdrlen, int maxtype, 395 - struct nla_policy *policy) 395 + const struct nla_policy *policy) 396 396 { 397 397 if (nlh->nlmsg_len < nlmsg_msg_size(hdrlen)) 398 398 return -EINVAL; ··· 729 729 */ 730 730 static inline int nla_parse_nested(struct nlattr *tb[], int maxtype, 731 731 struct nlattr *nla, 732 - struct nla_policy *policy) 732 + const struct nla_policy *policy) 733 733 { 734 734 return nla_parse(tb, maxtype, nla_data(nla), nla_len(nla), policy); 735 735 } ··· 990 990 * Returns 0 on success or a negative error code. 991 991 */ 992 992 static inline int nla_validate_nested(struct nlattr *start, int maxtype, 993 - struct nla_policy *policy) 993 + const struct nla_policy *policy) 994 994 { 995 995 return nla_validate(nla_data(start), nla_len(start), maxtype, policy); 996 996 }
+2 -2
net/core/neighbour.c
··· 1761 1761 return NULL; 1762 1762 } 1763 1763 1764 - static struct nla_policy nl_neightbl_policy[NDTA_MAX+1] __read_mostly = { 1764 + static const struct nla_policy nl_neightbl_policy[NDTA_MAX+1] = { 1765 1765 [NDTA_NAME] = { .type = NLA_STRING }, 1766 1766 [NDTA_THRESH1] = { .type = NLA_U32 }, 1767 1767 [NDTA_THRESH2] = { .type = NLA_U32 }, ··· 1770 1770 [NDTA_PARMS] = { .type = NLA_NESTED }, 1771 1771 }; 1772 1772 1773 - static struct nla_policy nl_ntbl_parm_policy[NDTPA_MAX+1] __read_mostly = { 1773 + static const struct nla_policy nl_ntbl_parm_policy[NDTPA_MAX+1] = { 1774 1774 [NDTPA_IFINDEX] = { .type = NLA_U32 }, 1775 1775 [NDTPA_QUEUE_LEN] = { .type = NLA_U32 }, 1776 1776 [NDTPA_PROXY_QLEN] = { .type = NLA_U32 },
+1 -1
net/core/rtnetlink.c
··· 551 551 return skb->len; 552 552 } 553 553 554 - static struct nla_policy ifla_policy[IFLA_MAX+1] __read_mostly = { 554 + static const struct nla_policy ifla_policy[IFLA_MAX+1] = { 555 555 [IFLA_IFNAME] = { .type = NLA_STRING, .len = IFNAMSIZ-1 }, 556 556 [IFLA_MAP] = { .len = sizeof(struct rtnl_link_ifmap) }, 557 557 [IFLA_MTU] = { .type = NLA_U32 },
+1 -1
net/decnet/dn_dev.c
··· 638 638 return dn_dev; 639 639 } 640 640 641 - static struct nla_policy dn_ifa_policy[IFA_MAX+1] __read_mostly = { 641 + static const struct nla_policy dn_ifa_policy[IFA_MAX+1] = { 642 642 [IFA_ADDRESS] = { .type = NLA_U16 }, 643 643 [IFA_LOCAL] = { .type = NLA_U16 }, 644 644 [IFA_LABEL] = { .type = NLA_STRING,
+1 -1
net/decnet/dn_rules.c
··· 108 108 return err; 109 109 } 110 110 111 - static struct nla_policy dn_fib_rule_policy[FRA_MAX+1] __read_mostly = { 111 + static const struct nla_policy dn_fib_rule_policy[FRA_MAX+1] = { 112 112 FRA_GENERIC_POLICY, 113 113 }; 114 114
+1 -1
net/ipv4/devinet.c
··· 84 84 85 85 #define IPV4_DEVCONF_DFLT(attr) IPV4_DEVCONF(ipv4_devconf_dflt, attr) 86 86 87 - static struct nla_policy ifa_ipv4_policy[IFA_MAX+1] __read_mostly = { 87 + static const struct nla_policy ifa_ipv4_policy[IFA_MAX+1] = { 88 88 [IFA_LOCAL] = { .type = NLA_U32 }, 89 89 [IFA_ADDRESS] = { .type = NLA_U32 }, 90 90 [IFA_BROADCAST] = { .type = NLA_U32 },
+1 -1
net/ipv4/fib_frontend.c
··· 441 441 return -EINVAL; 442 442 } 443 443 444 - struct nla_policy rtm_ipv4_policy[RTA_MAX+1] __read_mostly = { 444 + const struct nla_policy rtm_ipv4_policy[RTA_MAX+1] = { 445 445 [RTA_DST] = { .type = NLA_U32 }, 446 446 [RTA_SRC] = { .type = NLA_U32 }, 447 447 [RTA_IIF] = { .type = NLA_U32 },
+1 -1
net/ipv4/fib_rules.c
··· 169 169 return NULL; 170 170 } 171 171 172 - static struct nla_policy fib4_rule_policy[FRA_MAX+1] __read_mostly = { 172 + static const struct nla_policy fib4_rule_policy[FRA_MAX+1] = { 173 173 FRA_GENERIC_POLICY, 174 174 [FRA_FLOW] = { .type = NLA_U32 }, 175 175 };
+1 -1
net/ipv6/addrconf.c
··· 2990 2990 return pfx; 2991 2991 } 2992 2992 2993 - static struct nla_policy ifa_ipv6_policy[IFA_MAX+1] __read_mostly = { 2993 + static const struct nla_policy ifa_ipv6_policy[IFA_MAX+1] = { 2994 2994 [IFA_ADDRESS] = { .len = sizeof(struct in6_addr) }, 2995 2995 [IFA_LOCAL] = { .len = sizeof(struct in6_addr) }, 2996 2996 [IFA_CACHEINFO] = { .len = sizeof(struct ifa_cacheinfo) },
+1 -1
net/ipv6/fib6_rules.c
··· 157 157 return 1; 158 158 } 159 159 160 - static struct nla_policy fib6_rule_policy[FRA_MAX+1] __read_mostly = { 160 + static const struct nla_policy fib6_rule_policy[FRA_MAX+1] = { 161 161 FRA_GENERIC_POLICY, 162 162 }; 163 163
+1 -1
net/ipv6/route.c
··· 1999 1999 fib6_clean_all(rt6_mtu_change_route, 0, &arg); 2000 2000 } 2001 2001 2002 - static struct nla_policy rtm_ipv6_policy[RTA_MAX+1] __read_mostly = { 2002 + static const struct nla_policy rtm_ipv6_policy[RTA_MAX+1] = { 2003 2003 [RTA_GATEWAY] = { .len = sizeof(struct in6_addr) }, 2004 2004 [RTA_OIF] = { .type = NLA_U32 }, 2005 2005 [RTA_IIF] = { .type = NLA_U32 },
+1 -1
net/netlabel/netlabel_cipso_v4.c
··· 59 59 }; 60 60 61 61 /* NetLabel Netlink attribute policy */ 62 - static struct nla_policy netlbl_cipsov4_genl_policy[NLBL_CIPSOV4_A_MAX + 1] = { 62 + static const struct nla_policy netlbl_cipsov4_genl_policy[NLBL_CIPSOV4_A_MAX + 1] = { 63 63 [NLBL_CIPSOV4_A_DOI] = { .type = NLA_U32 }, 64 64 [NLBL_CIPSOV4_A_MTYPE] = { .type = NLA_U32 }, 65 65 [NLBL_CIPSOV4_A_TAG] = { .type = NLA_U8 },
+1 -1
net/netlabel/netlabel_mgmt.c
··· 59 59 }; 60 60 61 61 /* NetLabel Netlink attribute policy */ 62 - static struct nla_policy netlbl_mgmt_genl_policy[NLBL_MGMT_A_MAX + 1] = { 62 + static const struct nla_policy netlbl_mgmt_genl_policy[NLBL_MGMT_A_MAX + 1] = { 63 63 [NLBL_MGMT_A_DOMAIN] = { .type = NLA_NUL_STRING }, 64 64 [NLBL_MGMT_A_PROTOCOL] = { .type = NLA_U32 }, 65 65 [NLBL_MGMT_A_VERSION] = { .type = NLA_U32 },
+1 -1
net/netlabel/netlabel_unlabeled.c
··· 61 61 }; 62 62 63 63 /* NetLabel Netlink attribute policy */ 64 - static struct nla_policy netlbl_unlabel_genl_policy[NLBL_UNLABEL_A_MAX + 1] = { 64 + static const struct nla_policy netlbl_unlabel_genl_policy[NLBL_UNLABEL_A_MAX + 1] = { 65 65 [NLBL_UNLABEL_A_ACPTFLG] = { .type = NLA_U8 }, 66 66 }; 67 67
+4 -4
net/netlink/attr.c
··· 24 24 }; 25 25 26 26 static int validate_nla(struct nlattr *nla, int maxtype, 27 - struct nla_policy *policy) 27 + const struct nla_policy *policy) 28 28 { 29 - struct nla_policy *pt; 29 + const struct nla_policy *pt; 30 30 int minlen = 0, attrlen = nla_len(nla); 31 31 32 32 if (nla->nla_type <= 0 || nla->nla_type > maxtype) ··· 99 99 * Returns 0 on success or a negative error code. 100 100 */ 101 101 int nla_validate(struct nlattr *head, int len, int maxtype, 102 - struct nla_policy *policy) 102 + const struct nla_policy *policy) 103 103 { 104 104 struct nlattr *nla; 105 105 int rem, err; ··· 130 130 * Returns 0 on success or a negative error code. 131 131 */ 132 132 int nla_parse(struct nlattr *tb[], int maxtype, struct nlattr *head, int len, 133 - struct nla_policy *policy) 133 + const struct nla_policy *policy) 134 134 { 135 135 struct nlattr *nla; 136 136 int rem, err;
+1 -1
net/netlink/genetlink.c
··· 472 472 return skb; 473 473 } 474 474 475 - static struct nla_policy ctrl_policy[CTRL_ATTR_MAX+1] __read_mostly = { 475 + static const struct nla_policy ctrl_policy[CTRL_ATTR_MAX+1] = { 476 476 [CTRL_ATTR_FAMILY_ID] = { .type = NLA_U16 }, 477 477 [CTRL_ATTR_FAMILY_NAME] = { .type = NLA_NUL_STRING, 478 478 .len = GENL_NAMSIZ - 1 },