/[packages]/cauldron/kernel/current/PATCHES/patches/0020-perf-tools-Free-printk-string-in-parse_ftrace_printk.patch
ViewVC logotype

Contents of /cauldron/kernel/current/PATCHES/patches/0020-perf-tools-Free-printk-string-in-parse_ftrace_printk.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1329221 - (show annotations) (download)
Fri Nov 9 22:05:45 2018 UTC (5 years, 10 months ago) by tmb
File size: 1654 byte(s)
add fixes from sashas autosel queue
1 From 1183b69a90190fa8438390493bfab0453ba08895 Mon Sep 17 00:00:00 2001
2 From: Sanskriti Sharma <sansharm@redhat.com>
3 Date: Tue, 2 Oct 2018 10:29:12 -0400
4 Subject: [PATCH 020/145] perf tools: Free 'printk' string in
5 parse_ftrace_printk()
6
7 [ Upstream commit 9c8a182e5a73e01afd11742a2ab887bf338fdafd ]
8
9 parse_ftrace_printk() tokenizes and parses a line, calling strdup() each
10 iteration. Add code to free this temporary format string duplicate.
11
12 Fixes the following coverity complaints:
13
14 Error: RESOURCE_LEAK (CWE-772):
15 tools/perf/util/trace-event-parse.c:158: overwrite_var: Overwriting
16 "printk" in "printk = strdup(fmt + 1)" leaks the storage that "printk"
17 points to.
18
19 tools/perf/util/trace-event-parse.c:162: leaked_storage: Variable
20 "printk" going out of scope leaks the storage it points to.
21
22 Signed-off-by: Sanskriti Sharma <sansharm@redhat.com>
23 Reviewed-by: Jiri Olsa <jolsa@kernel.org>
24 Cc: Joe Lawrence <joe.lawrence@redhat.com>
25 Link: http://lkml.kernel.org/r/1538490554-8161-4-git-send-email-sansharm@redhat.com
26 Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
27 Signed-off-by: Sasha Levin <sashal@kernel.org>
28 ---
29 tools/perf/util/trace-event-parse.c | 1 +
30 1 file changed, 1 insertion(+)
31
32 diff --git a/tools/perf/util/trace-event-parse.c b/tools/perf/util/trace-event-parse.c
33 index e76214f8d596..b15a9bf1837b 100644
34 --- a/tools/perf/util/trace-event-parse.c
35 +++ b/tools/perf/util/trace-event-parse.c
36 @@ -158,6 +158,7 @@ void parse_ftrace_printk(struct tep_handle *pevent,
37 printk = strdup(fmt+1);
38 line = strtok_r(NULL, "\n", &next);
39 tep_register_print_string(pevent, printk, addr);
40 + free(printk);
41 }
42 }
43
44 --
45 2.19.1
46

  ViewVC Help
Powered by ViewVC 1.1.30