* [PATCH] perf session: Fix possible null pointer dereference in session.c
@ 2014-05-14 17:13 Masanari Iida
2014-05-15 7:44 ` Jiri Olsa
2014-05-21 5:55 ` [tip:perf/core] " tip-bot for Masanari Iida
0 siblings, 2 replies; 3+ messages in thread
From: Masanari Iida @ 2014-05-14 17:13 UTC (permalink / raw)
To: a.p.zijlstra, paulus, jolsa, acme, linux-kernel; +Cc: Masanari Iida
cppcheck detected following warning.
[tools/perf/util/session.c:1628] -> [tools/perf/util/session.c:1632]:
(warning) Possible null pointer dereference: session - otherwise it
is redundant to check it against null.
In order to avoide null pointer, check the pointer before use.
Signed-off-by: Masanari Iida <standby24x7@gmail.com>
---
tools/perf/util/session.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c
index 55960f2..64a186e 100644
--- a/tools/perf/util/session.c
+++ b/tools/perf/util/session.c
@@ -1625,13 +1625,14 @@ out_delete_map:
void perf_session__fprintf_info(struct perf_session *session, FILE *fp,
bool full)
{
- int fd = perf_data_file__fd(session->file);
struct stat st;
- int ret;
+ int fd, ret;
if (session == NULL || fp == NULL)
return;
+ fd = perf_data_file__fd(session->file);
+
ret = fstat(fd, &st);
if (ret == -1)
return;
--
2.0.0.rc3.2.g998f840
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] perf session: Fix possible null pointer dereference in session.c
2014-05-14 17:13 [PATCH] perf session: Fix possible null pointer dereference in session.c Masanari Iida
@ 2014-05-15 7:44 ` Jiri Olsa
2014-05-21 5:55 ` [tip:perf/core] " tip-bot for Masanari Iida
1 sibling, 0 replies; 3+ messages in thread
From: Jiri Olsa @ 2014-05-15 7:44 UTC (permalink / raw)
To: Masanari Iida; +Cc: a.p.zijlstra, paulus, acme, linux-kernel
On Thu, May 15, 2014 at 02:13:38AM +0900, Masanari Iida wrote:
> cppcheck detected following warning.
> [tools/perf/util/session.c:1628] -> [tools/perf/util/session.c:1632]:
> (warning) Possible null pointer dereference: session - otherwise it
> is redundant to check it against null.
>
> In order to avoide null pointer, check the pointer before use.
>
> Signed-off-by: Masanari Iida <standby24x7@gmail.com>
applied, thanks
jirka
> ---
> tools/perf/util/session.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c
> index 55960f2..64a186e 100644
> --- a/tools/perf/util/session.c
> +++ b/tools/perf/util/session.c
> @@ -1625,13 +1625,14 @@ out_delete_map:
> void perf_session__fprintf_info(struct perf_session *session, FILE *fp,
> bool full)
> {
> - int fd = perf_data_file__fd(session->file);
> struct stat st;
> - int ret;
> + int fd, ret;
>
> if (session == NULL || fp == NULL)
> return;
>
> + fd = perf_data_file__fd(session->file);
> +
> ret = fstat(fd, &st);
> if (ret == -1)
> return;
> --
> 2.0.0.rc3.2.g998f840
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* [tip:perf/core] perf session: Fix possible null pointer dereference in session.c
2014-05-14 17:13 [PATCH] perf session: Fix possible null pointer dereference in session.c Masanari Iida
2014-05-15 7:44 ` Jiri Olsa
@ 2014-05-21 5:55 ` tip-bot for Masanari Iida
1 sibling, 0 replies; 3+ messages in thread
From: tip-bot for Masanari Iida @ 2014-05-21 5:55 UTC (permalink / raw)
To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, jolsa, tglx, standby24x7
Commit-ID: c5765ece8a050836c6255e1276fc8e0e867078da
Gitweb: http://git.kernel.org/tip/c5765ece8a050836c6255e1276fc8e0e867078da
Author: Masanari Iida <standby24x7@gmail.com>
AuthorDate: Thu, 15 May 2014 02:13:38 +0900
Committer: Jiri Olsa <jolsa@kernel.org>
CommitDate: Fri, 16 May 2014 09:18:51 +0200
perf session: Fix possible null pointer dereference in session.c
cppcheck detected following warning:
[tools/perf/util/session.c:1628] -> [tools/perf/util/session.c:1632]:
(warning) Possible null pointer dereference: session - otherwise it
is redundant to check it against null.
In order to avoide null pointer, check the pointer before use.
Signed-off-by: Masanari Iida <standby24x7@gmail.com>
Link: http://lkml.kernel.org/r/1400087618-13628-1-git-send-email-standby24x7@gmail.com
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
---
tools/perf/util/session.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c
index 55960f2..64a186e 100644
--- a/tools/perf/util/session.c
+++ b/tools/perf/util/session.c
@@ -1625,13 +1625,14 @@ out_delete_map:
void perf_session__fprintf_info(struct perf_session *session, FILE *fp,
bool full)
{
- int fd = perf_data_file__fd(session->file);
struct stat st;
- int ret;
+ int fd, ret;
if (session == NULL || fp == NULL)
return;
+ fd = perf_data_file__fd(session->file);
+
ret = fstat(fd, &st);
if (ret == -1)
return;
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-05-21 5:55 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-05-14 17:13 [PATCH] perf session: Fix possible null pointer dereference in session.c Masanari Iida
2014-05-15 7:44 ` Jiri Olsa
2014-05-21 5:55 ` [tip:perf/core] " tip-bot for Masanari Iida
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®