函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:lib\nlattr.c Create Date:2022-07-27 08:14:48
Last Modify:2020-03-12 14:18:49 Copyright©Brick
首页 函数Tree
注解内核,赢得工具下载SCCTEnglish

函数名称:validate_nla

函数原型:static int validate_nla(const struct nlattr *nla, int maxtype, const struct nla_policy *policy, unsigned int validate, struct netlink_ext_ack *extack)

返回类型:int

参数:

类型参数名称
const struct nlattr *nla
intmaxtype
const struct nla_policy *policy
unsigned intvalidate
struct netlink_ext_ack *extack
161  strict_start_type等于This entry is special, and used for the attribute at index 0* only, and specifies special data about the policy, namely it* specifies the "boundary type" where strict length validation* starts for any attribute types >= this value, also, strict
163  minlen等于0, attrlen等于有效载荷的长度, type等于属性类型
164  err等于负ERANGE
166  如果strict_start_typetype大于等于strict_start_typevalidate或等于NL_VALIDATE_STRICT
169  如果type小于等于0或type大于maxtype则返回:0
172  pt等于policy[type]
174  BUG_ON(specific validation (e.g. range, function call), see > NLA_TYPE_MAX)
176  如果For these data types, attribute length should be exactly the given* size. However, to maintain compatibility with broken commands, if the* attribute length does not match the expected size a warning is emitted[specific validation (e.g. range, function call), see]且attrlen不等于For these data types, attribute length should be exactly the given* size. However, to maintain compatibility with broken commands, if the* attribute length does not match the expected size a warning is emitted[specific validation (e.g. range, function call), see]或specific validation (e.g. range, function call), see恒等于NLA_EXACT_LEN_WARNattrlen不等于len
178  pr_warn_ratelimited("netlink: '%s': attribute type %d has an invalid length.\n", comm, type)
180  如果validate按位与NL_VALIDATE_STRICT_ATTRS
181  NL_SET_ERR_MSG_ATTR(extack, nla, "invalid attribute length")
183  返回:负EINVAL
187  如果validate按位与NL_VALIDATE_NESTED
190  NL_SET_ERR_MSG_ATTR(extack, nla, "NLA_F_NESTED is missing")
192  返回:负EINVAL
196  NL_SET_ERR_MSG_ATTR(extack, nla, "NLA_F_NESTED not expected")
198  返回:负EINVAL
204  如果attrlen不等于len则转到:out_err
206  退出
209  如果extackvalidation_data
211  _msg等于validation_data
212  返回:负EINVAL
214  err等于负EINVAL
215  转到:out_err
218  如果attrlen大于0则转到:out_err
220  退出
223  如果attrlen不等于sizeof(structnla_bitfield32)则转到:out_err
227  如果err则转到:out_err
229  退出
244  如果attrlen小于1则转到:out_err
247  如果len
250  如果buf[attrlen - 1]恒等于'\0'则attrlen自减
253  如果attrlen大于len则转到:out_err
256  退出
259  如果lenattrlen大于len则转到:out_err
261  退出
267  如果attrlen恒等于0则退出
269  如果attrlen小于NLA_HDRLEN则转到:out_err
271  如果validation_data
283  退出
288  如果attrlen恒等于0则退出
290  如果attrlen小于NLA_HDRLEN则转到:out_err
292  如果validation_data
306  退出
309  如果validate按位与NL_VALIDATE_UNSPEC
310  NL_SET_ERR_MSG_ATTR(extack, nla, "Unsupported attribute")
312  返回:负EINVAL
316  如果attrlen小于len则转到:out_err
318  退出
320  默认
321  如果lenminlen等于len
326  如果attrlen小于minlen则转到:out_err
334  退出
339  如果err则返回:err
341  退出
343  如果validate
344  err等于validate(nla, extack)
345  如果err则返回:err
348  退出
351  返回:0
352  out_err :
353  NL_SET_ERR_MSG_ATTR(extack, nla, "Attribute failed policy validation")
354  返回:err
调用者
名称描述
__nla_validate_parse