* [PATCH] perf tools: fix handling read result
@ 2015-10-06 9:00 ` Andrzej Hajda
0 siblings, 0 replies; 5+ messages in thread
From: Andrzej Hajda @ 2015-10-06 9:00 UTC (permalink / raw)
To: linux-kernel
Cc: Andrzej Hajda, Bartlomiej Zolnierkiewicz, Marek Szyprowski,
Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
kernel-janitors
The function can return negative value, assigning it to unsigned
variable can cause memory corruption.
The problem has been detected using proposed semantic patch
scripts/coccinelle/tests/unsigned_lesser_than_zero.cocci [1].
[1]: http://permalink.gmane.org/gmane.linux.kernel/2038576
Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
---
tools/perf/util/event.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/tools/perf/util/event.c b/tools/perf/util/event.c
index cb98b5a..8b10621 100644
--- a/tools/perf/util/event.c
+++ b/tools/perf/util/event.c
@@ -67,7 +67,8 @@ static int perf_event__get_comm_ids(pid_t pid, char *comm, size_t len,
char filename[PATH_MAX];
char bf[4096];
int fd;
- size_t size = 0, n;
+ size_t size = 0;
+ ssize_t n;
char *nl, *name, *tgids, *ppids;
*tgid = -1;
--
1.9.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH] perf tools: fix handling read result
@ 2015-10-06 9:00 ` Andrzej Hajda
0 siblings, 0 replies; 5+ messages in thread
From: Andrzej Hajda @ 2015-10-06 9:00 UTC (permalink / raw)
To: linux-kernel
Cc: Andrzej Hajda, Bartlomiej Zolnierkiewicz, Marek Szyprowski,
Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
kernel-janitors
The function can return negative value, assigning it to unsigned
variable can cause memory corruption.
The problem has been detected using proposed semantic patch
scripts/coccinelle/tests/unsigned_lesser_than_zero.cocci [1].
[1]: http://permalink.gmane.org/gmane.linux.kernel/2038576
Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
---
tools/perf/util/event.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/tools/perf/util/event.c b/tools/perf/util/event.c
index cb98b5a..8b10621 100644
--- a/tools/perf/util/event.c
+++ b/tools/perf/util/event.c
@@ -67,7 +67,8 @@ static int perf_event__get_comm_ids(pid_t pid, char *comm, size_t len,
char filename[PATH_MAX];
char bf[4096];
int fd;
- size_t size = 0, n;
+ size_t size = 0;
+ ssize_t n;
char *nl, *name, *tgids, *ppids;
*tgid = -1;
--
1.9.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] perf tools: fix handling read result
2015-10-06 9:00 ` Andrzej Hajda
@ 2015-10-06 13:40 ` Arnaldo Carvalho de Melo
-1 siblings, 0 replies; 5+ messages in thread
From: Arnaldo Carvalho de Melo @ 2015-10-06 13:40 UTC (permalink / raw)
To: Andrzej Hajda
Cc: linux-kernel, Bartlomiej Zolnierkiewicz, Marek Szyprowski,
Peter Zijlstra, Ingo Molnar, kernel-janitors
Em Tue, Oct 06, 2015 at 11:00:17AM +0200, Andrzej Hajda escreveu:
> The function can return negative value, assigning it to unsigned
> variable can cause memory corruption.
>
> The problem has been detected using proposed semantic patch
> scripts/coccinelle/tests/unsigned_lesser_than_zero.cocci [1].
>
> [1]: http://permalink.gmane.org/gmane.linux.kernel/2038576
Thanks, applied.
- Arnaldo
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] perf tools: fix handling read result
@ 2015-10-06 13:40 ` Arnaldo Carvalho de Melo
0 siblings, 0 replies; 5+ messages in thread
From: Arnaldo Carvalho de Melo @ 2015-10-06 13:40 UTC (permalink / raw)
To: Andrzej Hajda
Cc: linux-kernel, Bartlomiej Zolnierkiewicz, Marek Szyprowski,
Peter Zijlstra, Ingo Molnar, kernel-janitors
Em Tue, Oct 06, 2015 at 11:00:17AM +0200, Andrzej Hajda escreveu:
> The function can return negative value, assigning it to unsigned
> variable can cause memory corruption.
>
> The problem has been detected using proposed semantic patch
> scripts/coccinelle/tests/unsigned_lesser_than_zero.cocci [1].
>
> [1]: http://permalink.gmane.org/gmane.linux.kernel/2038576
Thanks, applied.
- Arnaldo
^ permalink raw reply [flat|nested] 5+ messages in thread
* [tip:perf/core] perf tools: Fix handling read result using a signed variable
2015-10-06 9:00 ` Andrzej Hajda
(?)
(?)
@ 2015-10-08 9:46 ` tip-bot for Andrzej Hajda
-1 siblings, 0 replies; 5+ messages in thread
From: tip-bot for Andrzej Hajda @ 2015-10-08 9:46 UTC (permalink / raw)
To: linux-tip-commits
Cc: linux-kernel, mingo, b.zolnierkie, hpa, m.szyprowski, acme, tglx,
a.p.zijlstra, a.hajda
Commit-ID: 38349665388fb079fb2bc8c46db9446dd976802a
Gitweb: http://git.kernel.org/tip/38349665388fb079fb2bc8c46db9446dd976802a
Author: Andrzej Hajda <a.hajda@samsung.com>
AuthorDate: Tue, 6 Oct 2015 11:00:17 +0200
Committer: Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Tue, 6 Oct 2015 18:04:59 -0300
perf tools: Fix handling read result using a signed variable
The function can return negative value, assigning it to unsigned
variable can cause memory corruption.
The problem has been detected using proposed semantic patch
scripts/coccinelle/tests/unsigned_lesser_than_zero.cocci [1].
[1]: http://permalink.gmane.org/gmane.linux.kernel/2038576
Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
Cc: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Cc: Marek Szyprowski <m.szyprowski@samsung.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: kernel-janitors@vger.kernel.org
Link: http://lkml.kernel.org/r/1444122017-16856-1-git-send-email-a.hajda@samsung.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/util/event.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/tools/perf/util/event.c b/tools/perf/util/event.c
index cb98b5a..8b10621 100644
--- a/tools/perf/util/event.c
+++ b/tools/perf/util/event.c
@@ -67,7 +67,8 @@ static int perf_event__get_comm_ids(pid_t pid, char *comm, size_t len,
char filename[PATH_MAX];
char bf[4096];
int fd;
- size_t size = 0, n;
+ size_t size = 0;
+ ssize_t n;
char *nl, *name, *tgids, *ppids;
*tgid = -1;
^ permalink raw reply related [flat|nested] 5+ messages in thread
end of thread, other threads:[~2015-10-08 9:47 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-06 9:00 [PATCH] perf tools: fix handling read result Andrzej Hajda
2015-10-06 9:00 ` Andrzej Hajda
2015-10-06 13:40 ` Arnaldo Carvalho de Melo
2015-10-06 13:40 ` Arnaldo Carvalho de Melo
2015-10-08 9:46 ` [tip:perf/core] perf tools: Fix handling read result using a signed variable tip-bot for Andrzej Hajda
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.