函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

函数名称:fei_write

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

返回类型:ssize_t

参数:

类型参数名称
struct file *file
const char __user *buffer
size_tcount
loff_t *ppos
248  如果count大于KSYM_NAME_LENcount等于KSYM_NAME_LEN
250  buf等于开辟内存
251  如果非buf则返回:负ENOMEM
254  如果copy_from_user(buf, buffer, count)则
255  ret等于负EFAULT
256  转到:out
258  buf[count]等于'\0'
259  sym等于strstrip(buf)
261  mutex_lock( & fei_lock)
264  如果sym[0]恒等于'\0'则
265  fei_attr_remove_all()
266  ret等于count
267  转到:out
270  如果sym[0]恒等于'!'则
271  attr等于fei_attr_lookup(sym + 1)
272  如果非attr
273  ret等于负ENOENT
274  转到:out
276  fei_attr_remove(attr)
277  ret等于count
278  转到:out
281  addr等于Lookup the address for this symbol. Returns 0 if not found.
282  如果非addr
283  ret等于负EINVAL
284  转到:out
286  如果非within_error_injection_list(addr)则
287  ret等于负ERANGE
288  转到:out
290  如果fei_attr_lookup(sym)则
291  ret等于负EBUSY
292  转到:out
294  attr等于fei_attr_new(sym, addr)
295  如果非attr
296  ret等于负ENOMEM
297  转到:out
300  ret等于register_kprobe( & kp)
301  如果非retfei_debugfs_add_attr(attr)
303  如果ret小于0则fei_attr_remove(attr)
305  否则
306  添加链表项
307  ret等于count
309  out :
310  kfree(buf)
311  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.
312  返回:ret