From: LuMingYin <11570291+yin-lum...@user.noreply.gitee.com>

At line 1408 of the file /linux/kernel/trace/trace_probe.c, pointer variables 
named code and tmp are defined. At line 1437, a new dynamic memory area is 
allocated using the function kcalloc. When the if statement at line 1467 
evaluates to true, the program jumps to the out label at line 1469. Within this 
function, there are two labels: out and fail. The difference between these two 
labels is that fail additionally frees the dynamic memory area pointed to by 
the variable code. Therefore, the program should jump to the fail label instead 
of the out label. This commit fixes this bug.

Signed-off-by: LuMingYin <11570291+yin-lum...@user.noreply.gitee.com>
---
 kernel/trace/trace_probe.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/trace/trace_probe.c b/kernel/trace/trace_probe.c
index dfe3ee6035ec..42bc0f362226 100644
--- a/kernel/trace/trace_probe.c
+++ b/kernel/trace/trace_probe.c
@@ -1466,7 +1466,7 @@ static int traceprobe_parse_probe_arg_body(const char 
*argv, ssize_t *size,
                parg->fmt = kmalloc(len, GFP_KERNEL);
                if (!parg->fmt) {
                        ret = -ENOMEM;
-                       goto out;
+                       goto fail;
                }
                snprintf(parg->fmt, len, "%s[%d]", parg->type->fmttype,
                         parg->count);
-- 
2.25.1


Reply via email to