| Function report | 
| Source Code: kernel\trace\trace_probe.c | Create Date:2022-07-28 12:43:06 | 
| Last Modify:2020-03-12 14:18:49 | Copyright©Brick | 
| home page | Tree | 
| Annotation kernel can get tool activity | Download SCCT | Chinese | 
Name:String length checking wrapper
Proto:static int traceprobe_parse_probe_arg_body(char *arg, ssize_t *size, struct probe_arg *parg, unsigned int flags, int offset)
Type:int
Parameter:
| Type | Parameter | Name | 
|---|---|---|
| char * | arg | |
| ssize_t * | size | |
| struct probe_arg * | parg | |
| unsigned int | flags | |
| int | offset | 
| 546 | struct fetch_insn * code, * scode, * tmp = NULL | 
| 551 | If len > MAX_ARGSTR_LEN Then | 
| 553 | Return -EINVAL | 
| 554 | Else if len == 0 Then | 
| 556 | Return -EINVAL | 
| 559 | Command of this argument = kstrdup(arg, GFP_KERNEL) | 
| 560 | If Not Command of this argument Then Return -ENOMEM | 
| 563 | t = strchr - Find the first occurrence of the character c in the string s.*@s: the string to be searched*@c: the character to search for | 
| 564 | If t Then | 
| 565 | t = '\0' | 
| 566 | t2 = strchr - Find the first occurrence of the character c in the string s.*@s: the string to be searched*@c: the character to search for | 
| 567 | If t2 Then | 
| 568 | t2++ = '\0' | 
| 569 | t3 = strchr - Find the first occurrence of the character c in the string s.*@s: the string to be searched*@c: the character to search for | 
| 570 | If Not t3 Then | 
| 574 | Return -EINVAL | 
| 575 | Else if t3[1] != '\0' Then | 
| 576 | trace_probe_log_err(offset + t3 + 1 - arg, BAD_ARRAY_SUFFIX) | 
| 578 | Return -EINVAL | 
| 580 | t3 = '\0' | 
| 582 | trace_probe_log_err(offset + t2 - arg, BAD_ARRAY_NUM) | 
| 584 | Return -EINVAL | 
| 586 | If Array count > MAX_ARRAY_LEN Then | 
| 587 | trace_probe_log_err(offset + t2 - arg, ARRAY_TOO_BIG) | 
| 589 | Return -EINVAL | 
| 600 | If Array count || t && strcmp(t, "string") Then Return -EINVAL | 
| 602 | Type of this argument = find_fetch_type("string") | 
| 603 | Else Type of this argument = find_fetch_type(t) | 
| 605 | If Not Type of this argument Then | 
| 610 | size += Byte size of type * If Array count Else 1 | 
| 612 | If Array count Then | 
| 615 | If Not Format string if needed Then Return -ENOMEM | 
| 621 | code = tmp = kcalloc - allocate memory for an array. The memory is set to zero.*@n: number of elements.*@size: element size.*@flags: the type of memory to allocate (see kmalloc). | 
| 624 | op = FETCH_OP_END | 
| 626 | ret = Recursive argument parser | 
| 632 | If Not strcmp(Name of type , "string") || Not strcmp(Name of type , "ustring") Then | 
| 634 | If op != Dereference: .offset && op != User-space Dereference: .offset && op != Immediate : .immediate && op != Current comm && op != Allocated data: .data Then | 
| 642 | If op == Immediate : .immediate || op == Current comm || Array count Then | 
| 650 | code++ | 
| 651 | If op != FETCH_OP_NOP Then | 
| 658 | If Not strcmp(Name of type , "ustring") || op == User-space Dereference: .offset Then op = User String: .offset, .size | 
| 661 | Else op = String: .offset, .size | 
| 663 | size = Byte size of type | 
| 664 | Dynamic array (string) is used = true | 
| 665 | Else if op == Dereference: .offset Then | 
| 666 | op = Mem: .offset, .size | 
| 667 | size = Byte size of type | 
| 668 | Else if op == User-space Dereference: .offset Then | 
| 669 | op = Mem: .offset, .size | 
| 670 | size = Byte size of type | 
| 671 | Else | 
| 683 | If (t != NULL) Then | 
| 685 | If ret Then | 
| 686 | trace_probe_log_err(offset + t - arg, BAD_BITFIELD) | 
| 687 | Go to fail | 
| 691 | If Array count Then | 
| 692 | If op != Mem: .offset, .size && op != String: .offset, .size && op != User String: .offset, .size Then | 
| 700 | code++ | 
| 701 | If op != FETCH_OP_NOP Then | 
| 706 | op = Array: .param = loop count | 
| 707 | param = Array count | 
| 709 | code++ | 
| 710 | op = FETCH_OP_END | 
| 713 | code = kcalloc - allocate memory for an array. The memory is set to zero.*@n: number of elements.*@size: element size.*@flags: the type of memory to allocate (see kmalloc). | 
| 719 | fail : | 
| 720 | If ret Then | 
| 721 | When code < tmp + ch + deref*N + store + mod + end <= 16, this allows N=12, enough cycle If op == Unresolved Symbol holder || op == Allocated data: .data Then | 
| 728 | Return ret | 
| Name | Describe | 
|---|---|
| traceprobe_parse_probe_arg | 
| Source code conversion tool public plug-in interface | X | 
|---|---|
| Support c/c++/esqlc/java Oracle/Informix/Mysql Plug-in can realize: logical Report Code generation and batch code conversion |