aboutsummaryrefslogtreecommitdiffstats
path: root/net/core/rtnetlink.c
diff options
context:
space:
mode:
authorThomas Graf <tgraf@suug.ch>2006-08-26 23:13:18 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2006-09-22 18:18:25 -0400
commit5176f91ea83f1a59eba4dba88634a4729d51d1ac (patch)
tree80b35d2cd7ab316f0ee96ab742fee5073b949130 /net/core/rtnetlink.c
parenta5531a5d852008be40811496029012f4ad3093d1 (diff)
[NETLINK]: Make use of NLA_STRING/NLA_NUL_STRING attribute validation
Converts existing NLA_STRING attributes to use the new validation features, saving a couple of temporary buffers. Signed-off-by: Thomas Graf <tgraf@suug.ch> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/core/rtnetlink.c')
-rw-r--r--net/core/rtnetlink.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
index 8f225499e32..0ebcf8488e9 100644
--- a/net/core/rtnetlink.c
+++ b/net/core/rtnetlink.c
@@ -371,8 +371,8 @@ static int rtnl_dump_ifinfo(struct sk_buff *skb, struct netlink_callback *cb)
371} 371}
372 372
373static struct nla_policy ifla_policy[IFLA_MAX+1] __read_mostly = { 373static struct nla_policy ifla_policy[IFLA_MAX+1] __read_mostly = {
374 [IFLA_IFNAME] = { .type = NLA_STRING }, 374 [IFLA_IFNAME] = { .type = NLA_STRING, .len = IFNAMSIZ-1 },
375 [IFLA_MAP] = { .minlen = sizeof(struct rtnl_link_ifmap) }, 375 [IFLA_MAP] = { .len = sizeof(struct rtnl_link_ifmap) },
376 [IFLA_MTU] = { .type = NLA_U32 }, 376 [IFLA_MTU] = { .type = NLA_U32 },
377 [IFLA_TXQLEN] = { .type = NLA_U32 }, 377 [IFLA_TXQLEN] = { .type = NLA_U32 },
378 [IFLA_WEIGHT] = { .type = NLA_U32 }, 378 [IFLA_WEIGHT] = { .type = NLA_U32 },
@@ -392,9 +392,8 @@ static int rtnl_setlink(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)
392 if (err < 0) 392 if (err < 0)
393 goto errout; 393 goto errout;
394 394
395 if (tb[IFLA_IFNAME] && 395 if (tb[IFLA_IFNAME])
396 nla_strlcpy(ifname, tb[IFLA_IFNAME], IFNAMSIZ) >= IFNAMSIZ) 396 nla_strlcpy(ifname, tb[IFLA_IFNAME], IFNAMSIZ);
397 return -EINVAL;
398 397
399 err = -EINVAL; 398 err = -EINVAL;
400 ifm = nlmsg_data(nlh); 399 ifm = nlmsg_data(nlh);