函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

函数名称:Do a strnlen, return length of string *with* final '\0'.* 'count' is the user-supplied count, while 'max' is the* address space maximum.* Return 0 for exceptions (which includes hitting the address* space maximum), or 'count+1' if hitting the user-supplied

函数原型:static inline long do_strnlen_user(const char __user *src, unsigned long count, unsigned long max)

返回类型:long

参数:

类型参数名称
const char __user *src
unsigned longcount
unsigned longmax
25  constants等于WORD_AT_A_TIME_CONSTANTS
26  res等于0
33  align等于sizeof(unsignedlong)减1按位与src
34  src减等于align
35  max加等于align
37  unsafe_get_user(c, (unsignedlong__user * )src, efault)
38  c或等于aligned_byte_mask(align)
40  循环
42  如果判断为零
45  返回:resfind_zero(data)加1减align
47  res加等于sizeof(unsignedlong)
49  如果此条件成立可能性小(为编译器优化)(max <= sizeof(unsignedlong))则退出
51  max减等于sizeof(unsignedlong)
52  unsafe_get_user(c, (unsignedlong__user * )(src + res), efault)
54  res减等于align
60  如果res大于等于count则返回:count加1
67  efault :
68  返回:0
调用者
名称描述
strnlen_user用户字符串长度