函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

函数名称:smk_write_net4addr - write() for /smack/netlabel*@file: file pointer, not actually used*@buf: where to get the data from*@count: bytes sent*@ppos: where to start* Accepts only one net4addr per write call

函数原型:static ssize_t smk_write_net4addr(struct file *file, const char __user *buf, size_t count, loff_t *ppos)

返回类型:ssize_t

参数:

类型参数名称
struct file *file
const char __user *buf
size_tcount
loff_t *ppos
1128  struct smack_known * skp = NULL
1130  char * host = (char * ) & s_addr
1137  mask_bits等于1左移31位
1148  如果非smack_privileged - are all privilege requirements met*@cap: The requested capability* Is the task privileged and allowed to be privileged* by the onlycap rule.* Returns true if the task is allowed to be privileged, false if it's not.则返回:负EPERM
1150  如果ppos不等于0则返回:负EINVAL
1152  如果count小于Value for parsing single label host rules* "1.2.3.4 X"则返回:负EINVAL
1155  data等于memdup_user_nul - duplicate memory region from user space and NUL-terminate*@src: source address in user space*@len: number of bytes to copy* Return: an ERR_PTR() on failure.
1156  如果是错误则返回:错误
1159  smack等于分配内存并置零
1160  如果(smack == NULL)则
1161  rc等于负ENOMEM
1162  转到:free_data_out
1165  rc等于sscanf - Unformat a buffer into a list of arguments*@buf: input buffer*@fmt: formatting of buffer*@...: resulting arguments
1167  如果rc不等于6则
1168  rc等于sscanf - Unformat a buffer into a list of arguments*@buf: input buffer*@fmt: formatting of buffer*@...: resulting arguments
1170  如果rc不等于5则
1171  rc等于负EINVAL
1172  转到:free_out
1174  m等于BEBITS
1175  masks等于32
1177  如果masks大于BEBITS
1178  rc等于负EINVAL
1179  转到:free_out
1185  如果smack[0]不等于'-'则
1186  skp等于smk_import_entry - import a label, return the list entry*@string: a text string that might be a Smack label*@len: the maximum size, or zero if it is NULL terminated
1187  如果是错误
1188  rc等于错误
1189  转到:free_out
1191  否则
1195  如果字符串比较不等于0则
1196  rc等于负EINVAL
1197  转到:free_out
1201 m大于0循环
1202  temp_mask或等于mask_bits
1203  mask_bits右移等于1位
1205  s_addr等于cpu_to_be32(temp_mask)
1207  s_addr与等于s_addr
1212  mutex_lock( & smk_net4addr_lock)
1214  nsa等于s_addr
1216  found等于0
1218  如果s_addr恒等于nsamask size 恒等于masks
1219  found等于1
1220  退出
1223  smk_netlabel_audit_set - fill a netlbl_audit struct*@nap: structure to fill
1225  如果found恒等于0则
1226  snp等于分配内存并置零
1227  如果(snp == NULL)则rc等于负ENOMEM
1229  否则
1230  rc等于0
1231  s_addr等于s_addr
1232  s_addr等于s_addr
1233  label 等于skp
1234  mask size 等于masks
1237  否则
1242  如果(label != NULL)则rc等于netlbl_cfg_unlbl_static_del( & init_net, NULL, & work address , & work mask , PF_INET, & audit_info)
1246  否则rc等于0
1248  label 等于skp
1256  如果(rc == 0 && skp != NULL)则rc等于netlbl_cfg_unlbl_static_add( & init_net, NULL, & work address , & work mask , PF_INET, smk_secid, & audit_info)
1261  如果rc恒等于0则rc等于count
1264  mutex_unlock - release the mutex*@lock: the mutex to be released* Unlock a mutex that has been locked by this task previously.* This function must not be used in interrupt context. Unlocking* of a not locked mutex is not allowed.
1266  free_out :
1267  释放内存
1268  free_data_out :
1269  释放内存
1271  返回:rc