mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 03:01:39 -04:00
[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 <[email protected]> Signed-off-by: David S. Miller <[email protected]>
This commit is contained in:
parent
a5531a5d85
commit
5176f91ea8
9 changed files with 17 additions and 26 deletions
|
|
@ -455,7 +455,8 @@ static struct sk_buff *ctrl_build_msg(struct genl_family *family, u32 pid,
|
|||
|
||||
static struct nla_policy ctrl_policy[CTRL_ATTR_MAX+1] __read_mostly = {
|
||||
[CTRL_ATTR_FAMILY_ID] = { .type = NLA_U16 },
|
||||
[CTRL_ATTR_FAMILY_NAME] = { .type = NLA_STRING },
|
||||
[CTRL_ATTR_FAMILY_NAME] = { .type = NLA_NUL_STRING,
|
||||
.len = GENL_NAMSIZ - 1 },
|
||||
};
|
||||
|
||||
static int ctrl_getfamily(struct sk_buff *skb, struct genl_info *info)
|
||||
|
|
@ -470,12 +471,9 @@ static int ctrl_getfamily(struct sk_buff *skb, struct genl_info *info)
|
|||
}
|
||||
|
||||
if (info->attrs[CTRL_ATTR_FAMILY_NAME]) {
|
||||
char name[GENL_NAMSIZ];
|
||||
|
||||
if (nla_strlcpy(name, info->attrs[CTRL_ATTR_FAMILY_NAME],
|
||||
GENL_NAMSIZ) >= GENL_NAMSIZ)
|
||||
goto errout;
|
||||
char *name;
|
||||
|
||||
name = nla_data(info->attrs[CTRL_ATTR_FAMILY_NAME]);
|
||||
res = genl_family_find_byname(name);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue