函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

函数名称:smk_write_net6addr - 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 net6addr per write call

函数原型:static ssize_t smk_write_net6addr(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
1391  struct smack_known * skp = NULL
1394  rc等于0
1395  found等于0
1399  mask等于128
1408  如果非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
1410  如果ppos不等于0则返回:负EINVAL
1412  如果count小于Value for parsing single label host rules* "1.2.3.4 X"则返回:负EINVAL
1415  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.
1416  如果是错误则返回:错误
1419  smack等于分配内存并置零
1420  如果(smack == NULL)则
1421  rc等于负ENOMEM
1422  转到:free_data_out
1425  i等于sscanf - Unformat a buffer into a list of arguments*@buf: input buffer*@fmt: formatting of buffer*@...: resulting arguments
1429  如果i不等于10则
1430  i等于sscanf - Unformat a buffer into a list of arguments*@buf: input buffer*@fmt: formatting of buffer*@...: resulting arguments
1434  如果i不等于9则
1435  rc等于负EINVAL
1436  转到:free_out
1439  如果mask大于128则
1440  rc等于负EINVAL
1441  转到:free_out
1443 i小于8循环
1444  如果scanned[i]大于0xffff则
1445  rc等于负EINVAL
1446  转到:free_out
1448  s6_addr16[i]等于htons(scanned[i])
1454  如果smack[0]不等于'-'则
1455  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
1456  如果是错误
1457  rc等于错误
1458  转到:free_out
1460  否则
1464  如果字符串比较不等于0则
1465  rc等于负EINVAL
1466  转到:free_out
1470 i小于8循环
1471  如果m大于等于16则
1472  s6_addr16[i]等于0xffff
1473  m减等于16
1474  否则如果m大于0则
1475  s6_addr16[i]等于1左移m位的值减1
1476  m等于0
1477  否则s6_addr16[i]等于0
1479  s6_addr16[i]与等于s6_addr16[i]
1486  mutex_lock( & smk_net6addr_lock)
1491  如果mask不等于mask size 则继续下一循环
1493 i小于8循环
1494  如果s6_addr16[i]不等于s6_addr16[i]则
1496  found等于0
1497  退出
1500  如果found恒等于1则退出
1503  如果found恒等于0则
1504  snp等于分配内存并置零
1505  如果(snp == NULL)则rc等于负ENOMEM
1507  否则
1508  work address 等于newname
1509  work mask 等于fullmask
1510  mask size 等于mask
1511  label 等于skp
1514  否则
1515  label 等于skp
1518  如果rc恒等于0则rc等于count
1521  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.
1523  free_out :
1524  释放内存
1525  free_data_out :
1526  释放内存
1528  返回:rc