Lines Matching refs:nla
61 static int validate_nla_bitfield32(const struct nlattr *nla, in validate_nla_bitfield32() argument
64 const struct nla_bitfield32 *bf = nla_data(nla); in validate_nla_bitfield32()
163 const struct nlattr *nla, in nla_validate_range_unsigned() argument
172 value = nla_get_u8(nla); in nla_validate_range_unsigned()
175 value = nla_get_u16(nla); in nla_validate_range_unsigned()
178 value = nla_get_u32(nla); in nla_validate_range_unsigned()
182 value = nla_get_u64(nla); in nla_validate_range_unsigned()
185 value = nla_len(nla); in nla_validate_range_unsigned()
198 NL_SET_ERR_MSG_ATTR_POL(extack, nla, pt, in nla_validate_range_unsigned()
211 NL_SET_ERR_MSG_ATTR_POL(extack, nla, pt, in nla_validate_range_unsigned()
214 NL_SET_ERR_MSG_ATTR_POL(extack, nla, pt, in nla_validate_range_unsigned()
268 const struct nlattr *nla, in nla_validate_int_range_signed() argument
276 value = nla_get_s8(nla); in nla_validate_int_range_signed()
279 value = nla_get_s16(nla); in nla_validate_int_range_signed()
282 value = nla_get_s32(nla); in nla_validate_int_range_signed()
285 value = nla_get_s64(nla); in nla_validate_int_range_signed()
294 NL_SET_ERR_MSG_ATTR_POL(extack, nla, pt, in nla_validate_int_range_signed()
303 const struct nlattr *nla, in nla_validate_int_range() argument
314 return nla_validate_range_unsigned(pt, nla, extack, validate); in nla_validate_int_range()
319 return nla_validate_int_range_signed(pt, nla, extack); in nla_validate_int_range()
327 const struct nlattr *nla, in nla_validate_mask() argument
334 value = nla_get_u8(nla); in nla_validate_mask()
337 value = nla_get_u16(nla); in nla_validate_mask()
340 value = nla_get_u32(nla); in nla_validate_mask()
343 value = nla_get_u64(nla); in nla_validate_mask()
350 NL_SET_ERR_MSG_ATTR(extack, nla, "reserved bit set"); in nla_validate_mask()
357 static int validate_nla(const struct nlattr *nla, int maxtype, in validate_nla() argument
363 int minlen = 0, attrlen = nla_len(nla), type = nla_type(nla); in validate_nla()
380 NL_SET_ERR_MSG_ATTR_POL(extack, nla, pt, in validate_nla()
388 !(nla->nla_type & NLA_F_NESTED)) { in validate_nla()
389 NL_SET_ERR_MSG_ATTR_POL(extack, nla, pt, in validate_nla()
394 pt->type != NLA_UNSPEC && (nla->nla_type & NLA_F_NESTED)) { in validate_nla()
395 NL_SET_ERR_MSG_ATTR_POL(extack, nla, pt, in validate_nla()
404 NL_SET_BAD_ATTR(extack, nla); in validate_nla()
420 err = validate_nla_bitfield32(nla, pt->bitfield32_valid); in validate_nla()
431 if (!minlen || memchr(nla_data(nla), '\0', minlen) == NULL) { in validate_nla()
442 char *buf = nla_data(nla); in validate_nla()
466 err = __nla_validate_parse(nla_data(nla), nla_len(nla), in validate_nla()
490 err = nla_validate_array(nla_data(nla), nla_len(nla), in validate_nla()
505 NL_SET_ERR_MSG_ATTR(extack, nla, in validate_nla()
533 err = nla_validate_int_range(pt, nla, extack, validate); in validate_nla()
538 err = nla_validate_mask(pt, nla, extack); in validate_nla()
544 err = pt->validate(nla, extack); in validate_nla()
553 NL_SET_ERR_MSG_ATTR_POL(extack, nla, pt, in validate_nla()
564 const struct nlattr *nla; in __nla_validate_parse() local
576 nla_for_each_attr(nla, head, len, rem) { in __nla_validate_parse()
577 u16 type = nla_type(nla); in __nla_validate_parse()
581 NL_SET_ERR_MSG_ATTR(extack, nla, in __nla_validate_parse()
588 int err = validate_nla(nla, maxtype, policy, in __nla_validate_parse()
596 tb[type] = (struct nlattr *)nla; in __nla_validate_parse()
700 const struct nlattr *nla; in nla_find() local
703 nla_for_each_attr(nla, head, len, rem) in nla_find()
704 if (nla_type(nla) == attrtype) in nla_find()
705 return (struct nlattr *)nla; in nla_find()
725 ssize_t nla_strscpy(char *dst, const struct nlattr *nla, size_t dstsize) in nla_strscpy() argument
727 size_t srclen = nla_len(nla); in nla_strscpy()
728 char *src = nla_data(nla); in nla_strscpy()
761 char *nla_strdup(const struct nlattr *nla, gfp_t flags) in nla_strdup() argument
763 size_t srclen = nla_len(nla); in nla_strdup()
764 char *src = nla_data(nla), *dst; in nla_strdup()
807 int nla_memcmp(const struct nlattr *nla, const void *data, in nla_memcmp() argument
810 int d = nla_len(nla) - size; in nla_memcmp()
813 d = memcmp(nla_data(nla), data, size); in nla_memcmp()
824 int nla_strcmp(const struct nlattr *nla, const char *str) in nla_strcmp() argument
827 char *buf = nla_data(nla); in nla_strcmp()
828 int attrlen = nla_len(nla); in nla_strcmp()
836 d = memcmp(nla_data(nla), str, len); in nla_strcmp()
857 struct nlattr *nla; in __nla_reserve() local
859 nla = skb_put(skb, nla_total_size(attrlen)); in __nla_reserve()
860 nla->nla_type = attrtype; in __nla_reserve()
861 nla->nla_len = nla_attr_size(attrlen); in __nla_reserve()
863 memset((unsigned char *) nla + nla->nla_len, 0, nla_padlen(attrlen)); in __nla_reserve()
865 return nla; in __nla_reserve()
991 struct nlattr *nla; in __nla_put() local
993 nla = __nla_reserve(skb, attrtype, attrlen); in __nla_put()
994 memcpy(nla_data(nla), data, attrlen); in __nla_put()
1012 struct nlattr *nla; in __nla_put_64bit() local
1014 nla = __nla_reserve_64bit(skb, attrtype, attrlen, padattr); in __nla_put_64bit()
1015 memcpy(nla_data(nla), data, attrlen); in __nla_put_64bit()