diff options
Diffstat (limited to 'net/netlink/attr.c')
-rw-r--r-- | net/netlink/attr.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/net/netlink/attr.c b/net/netlink/attr.c index 2d106cfe1d27..56c3ce7fe29a 100644 --- a/net/netlink/attr.c +++ b/net/netlink/attr.c | |||
@@ -83,6 +83,12 @@ static int validate_nla(struct nlattr *nla, int maxtype, | |||
83 | if (attrlen < NLA_ALIGN(pt->len) + NLA_HDRLEN + nla_len(nla)) | 83 | if (attrlen < NLA_ALIGN(pt->len) + NLA_HDRLEN + nla_len(nla)) |
84 | return -ERANGE; | 84 | return -ERANGE; |
85 | break; | 85 | break; |
86 | case NLA_NESTED: | ||
87 | /* a nested attributes is allowed to be empty; if its not, | ||
88 | * it must have a size of at least NLA_HDRLEN. | ||
89 | */ | ||
90 | if (attrlen == 0) | ||
91 | break; | ||
86 | default: | 92 | default: |
87 | if (pt->len) | 93 | if (pt->len) |
88 | minlen = pt->len; | 94 | minlen = pt->len; |
@@ -233,7 +239,7 @@ size_t nla_strlcpy(char *dst, const struct nlattr *nla, size_t dstsize) | |||
233 | * | 239 | * |
234 | * Returns the number of bytes copied. | 240 | * Returns the number of bytes copied. |
235 | */ | 241 | */ |
236 | int nla_memcpy(void *dest, struct nlattr *src, int count) | 242 | int nla_memcpy(void *dest, const struct nlattr *src, int count) |
237 | { | 243 | { |
238 | int minlen = min_t(int, count, nla_len(src)); | 244 | int minlen = min_t(int, count, nla_len(src)); |
239 | 245 | ||