Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:lib\strnlen_user.c Create Date:2022-07-28 07:20:14
Last Modify:2020-03-12 14:18:49 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name: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

Proto:static inline long do_strnlen_user(const char __user *src, unsigned long count, unsigned long max)

Type:long

Parameter:

TypeParameterName
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  cycle
45  Return res + find_zero(data) + 1 - align
47  res += sizeof(unsignedlong)
49  If Value for the false possibility is greater at compile time(max <= sizeof(unsignedlong)) Then Break
51  max -= sizeof(unsignedlong)
52  unsafe_get_user(c, (unsignedlong__user * )(src + res), efault)
54  res -= align
60  If res >= count Then Return count + 1
67  efault :
68  Return 0
Caller
NameDescribe
strnlen_userGet the size of a string in user space