Function report | 
Source Code:lib\nlattr.c | 
Create Date:2022-07-28 07:16:21 | 
| Last Modify:2020-03-12 14:18:49 | Copyright©Brick | 
| home page | Tree | 
| Annotation kernel can get tool activity | Download SCCT | Chinese | 
Name:validate_nla
Proto:static int validate_nla(const struct nlattr *nla, int maxtype, const struct nla_policy *policy, unsigned int validate, struct netlink_ext_ack *extack)
Type:int
Parameter:
| Type | Parameter | Name | 
|---|---|---|
| const struct nlattr * | nla | |
| int | maxtype | |
| const struct nla_policy * | policy | |
| unsigned int | validate | |
| struct netlink_ext_ack * | extack | 
| 163 | minlen = 0 , attrlen = la_len - length of payload*@nla: netlink attribute , type = la_type - attribute type*@nla: netlink attribute | 
| 166 | If strict_start_type && type >= strict_start_type Then validate |= NL_VALIDATE_STRICT | 
| 178 | pr_warn_ratelimited("netlink: '%s': attribute type %d has an invalid length.\n", comm, type) | 
| 180 | If validate & NL_VALIDATE_STRICT_ATTRS Then | 
| 181 | NL_SET_ERR_MSG_ATTR(extack, nla, "invalid attribute length") | 
| 183 | Return -EINVAL | 
| 187 | If validate & NL_VALIDATE_NESTED Then | 
| 190 | NL_SET_ERR_MSG_ATTR(extack, nla, "NLA_F_NESTED is missing") | 
| 192 | Return -EINVAL | 
| 196 | NL_SET_ERR_MSG_ATTR(extack, nla, "NLA_F_NESTED not expected") | 
| 198 | Return -EINVAL | 
| 209 | If extack && validation_data Then | 
| 215 | Go to out_err | 
| 223 | If attrlen != sizeof(structnla_bitfield32) Then Go to out_err | 
| 226 | err = validate_nla_bitfield32(nla, validation_data) | 
| 229 | Break | 
| 232 | If len Then minlen = min_t - return minimum of two values, using the specified type*@type: data type to use*@x: first value*@y: second value(int, attrlen, len + 1) | 
| 237 | If (!minlen || memchr(la_data - head of payload*@nla: netlink attribute, '\0', minlen) == NULL) Then | 
| 267 | If attrlen == 0 Then Break | 
| 269 | If attrlen < NLA_HDRLEN Then Go to out_err | 
| 271 | If validation_data Then | 
| 272 | err = __nla_validate(la_data - head of payload*@nla: netlink attribute, la_len - length of payload*@nla: netlink attribute, len, validation_data, validate, extack) | 
| 275 | If err < 0 Then | 
| 280 | Return err | 
| 283 | Break | 
| 288 | If attrlen == 0 Then Break | 
| 290 | If attrlen < NLA_HDRLEN Then Go to out_err | 
| 292 | If validation_data Then | 
| 295 | err = nla_validate_array(la_data - head of payload*@nla: netlink attribute, la_len - length of payload*@nla: netlink attribute, len, validation_data, extack, validate) | 
| 298 | If err < 0 Then | 
| 303 | Return err | 
| 306 | Break | 
| 309 | If validate & NL_VALIDATE_UNSPEC Then | 
| 310 | NL_SET_ERR_MSG_ATTR(extack, nla, "Unsupported attribute") | 
| 312 | Return -EINVAL | 
| 320 | Default | 
| 332 | Case validation_type == NLA_VALIDATE_NONE | 
| 334 | Break | 
| 335 | Case validation_type == NLA_VALIDATE_RANGE | 
| 336 | Case validation_type == NLA_VALIDATE_MIN | 
| 337 | Case validation_type == NLA_VALIDATE_MAX | 
| 342 | Case validation_type == NLA_VALIDATE_FUNCTION | 
| 351 | Return 0 | 
| 352 | out_err : | 
| 353 | NL_SET_ERR_MSG_ATTR(extack, nla, "Attribute failed policy validation") | 
| 354 | Return err | 
| Name | Describe | 
|---|---|
| __nla_validate_parse | 
| Source code conversion tool public plug-in interface  | X | 
|---|---|
| Support c/c++/esqlc/java Oracle/Informix/Mysql Plug-in can realize: logical Report Code generation and batch code conversion  |