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-prev] [thread-next>] [day] [month] [year] [list]
Date:   Mon, 28 Aug 2017 11:30:06 -0700
From:   David Carrillo-Cisneros <davidcc@...gle.com>
To:     linux-kernel@...r.kernel.org
Cc:     Arnaldo Carvalho de Melo <acme@...nel.org>,
        Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
        Jiri Olsa <jolsa@...hat.com>,
        Stephane Eranian <eranian@...gle.com>,
        Paul Turner <pjt@...gle.com>,
        David Carrillo-Cisneros <davidcc@...gle.com>
Subject: [PATCH] perf tools: Remove BUG_ON char[] to bool implicit conversions

When compiling with LLVM, errors like this are shown:

  builtin-lock.c:46:10: error: implicit conversion turns string literal into bool: 'const char [39]' to 'bool'

due to error message implicit conversion into bool. Fix it printing
the error message and returning an error when possible.

Signed-off-by: David Carrillo-Cisneros <davidcc@...gle.com>
---
 tools/perf/builtin-lock.c | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/tools/perf/builtin-lock.c b/tools/perf/builtin-lock.c
index ff98652484a7..55d3997ce194 100644
--- a/tools/perf/builtin-lock.c
+++ b/tools/perf/builtin-lock.c
@@ -3,6 +3,7 @@
 #include "builtin.h"
 #include "perf.h"
 
+#include "asm/bug.h"
 #include "util/evlist.h"
 #include "util/evsel.h"
 #include "util/util.h"
@@ -147,12 +148,11 @@ static void thread_stat_insert(struct thread_stat *new)
 		p = container_of(*rb, struct thread_stat, rb);
 		parent = *rb;
 
+		WARN(new->tid == p->tid, "inserting invalid thread_stat\n");
 		if (new->tid < p->tid)
 			rb = &(*rb)->rb_left;
-		else if (new->tid > p->tid)
-			rb = &(*rb)->rb_right;
 		else
-			BUG_ON("inserting invalid thread_stat\n");
+			rb = &(*rb)->rb_right;
 	}
 
 	rb_link_node(&new->rb, parent, rb);
@@ -457,8 +457,8 @@ static int report_lock_acquire_event(struct perf_evsel *evsel,
 		free(seq);
 		goto end;
 	default:
-		BUG_ON("Unknown state of lock sequence found!\n");
-		break;
+		pr_err("Unknown state of lock sequence found!\n");
+		return -1;
 	}
 
 	ls->nr_acquire++;
@@ -518,8 +518,8 @@ static int report_lock_acquired_event(struct perf_evsel *evsel,
 		free(seq);
 		goto end;
 	default:
-		BUG_ON("Unknown state of lock sequence found!\n");
-		break;
+		pr_err("Unknown state of lock sequence found!\n");
+		return -1;
 	}
 
 	seq->state = SEQ_STATE_ACQUIRED;
@@ -573,8 +573,8 @@ static int report_lock_contended_event(struct perf_evsel *evsel,
 		free(seq);
 		goto end;
 	default:
-		BUG_ON("Unknown state of lock sequence found!\n");
-		break;
+		pr_err("Unknown state of lock sequence found!\n");
+		return -1;
 	}
 
 	seq->state = SEQ_STATE_CONTENDED;
@@ -632,8 +632,8 @@ static int report_lock_release_event(struct perf_evsel *evsel,
 		bad_hist[BROKEN_RELEASE]++;
 		goto free_seq;
 	default:
-		BUG_ON("Unknown state of lock sequence found!\n");
-		break;
+		pr_err("Unknown state of lock sequence found!\n");
+		return -1;
 	}
 
 	ls->nr_release++;
-- 
2.14.1.342.g6490525c54-goog

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ