lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:   Wed, 17 May 2017 16:08:37 +0900
From:   Namhyung Kim <namhyung@...nel.org>
To:     Arnaldo Carvalho de Melo <acme@...nel.org>
Cc:     Ingo Molnar <mingo@...nel.org>,
        Peter Zijlstra <peterz@...radead.org>,
        Jiri Olsa <jolsa@...nel.org>,
        LKML <linux-kernel@...r.kernel.org>, kernel-team@....com,
        Milian Wolff <milian.wolff@...b.com>,
        Frederic Weisbecker <fweisbec@...il.com>
Subject: [PATCH] perf report: Fix invalid warning on callchain param

Currently "perf report -g srcline --stdio" shows two warnings like
below:

  Invalid callchain mode: srcline
  Invalid callchain order: srcline

This is because it always tries to parse callchain mode, order, sort-key
and value-type in a row.  So even if 'srcline' is a valid sort-key, it
shows invalid mode and order warnings.

Change it to show a warning only if failed to parse the given token as
any of valid parameter.  Also code under try_numbers requires the token
to be a number, it's good to show the warning there.

Cc: Milian Wolff <milian.wolff@...b.com>
Cc: Frederic Weisbecker <fweisbec@...il.com>
Signed-off-by: Namhyung Kim <namhyung@...nel.org>
---
 tools/perf/util/callchain.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/tools/perf/util/callchain.c b/tools/perf/util/callchain.c
index 9ab68682c6d0..89dbfd9e6d24 100644
--- a/tools/perf/util/callchain.c
+++ b/tools/perf/util/callchain.c
@@ -15,6 +15,7 @@
 #include <stdbool.h>
 #include <errno.h>
 #include <math.h>
+#include <ctype.h>
 
 #include "asm/bug.h"
 
@@ -65,7 +66,6 @@ static int parse_callchain_mode(const char *value)
 		return 0;
 	}
 
-	pr_err("Invalid callchain mode: %s\n", value);
 	return -1;
 }
 
@@ -82,7 +82,6 @@ static int parse_callchain_order(const char *value)
 		return 0;
 	}
 
-	pr_err("Invalid callchain order: %s\n", value);
 	return -1;
 }
 
@@ -105,7 +104,6 @@ static int parse_callchain_sort_key(const char *value)
 		return 0;
 	}
 
-	pr_err("Invalid callchain sort key: %s\n", value);
 	return -1;
 }
 
@@ -124,7 +122,6 @@ static int parse_callchain_value(const char *value)
 		return 0;
 	}
 
-	pr_err("Invalid callchain config key: %s\n", value);
 	return -1;
 }
 
@@ -197,6 +194,9 @@ __parse_callchain_report_opt(const char *arg, bool allow_record_opt)
 		}
 
 try_numbers:
+		if (!isdigit(*tok))
+			pr_err("Invalid callchain param: %s\n", tok);
+
 		if (try_stack_size) {
 			unsigned long size = 0;
 
-- 
2.12.2

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ