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:   Thu, 28 Jul 2022 19:58:51 +0800
From:   Yang Jihong <yangjihong1@...wei.com>
To:     <peterz@...radead.org>, <mingo@...hat.com>, <acme@...nel.org>,
        <mark.rutland@....com>, <alexander.shishkin@...ux.intel.com>,
        <jolsa@...nel.org>, <namhyung@...nel.org>,
        <colin.i.king@...il.com>, <linux-kernel@...r.kernel.org>,
        <linux-perf-users@...r.kernel.org>
CC:     <pc@...ibm.com>, <yhs@...com>, <andrii.nakryiko@...il.com>,
        <songliubraving@...com>, <yangjihong1@...wei.com>
Subject: [PATCH 2/5] perf kwork: Replace hard-coded initialization of nr_tracepoints with ARRAY_SIZE macro

Use ARRAY_SIZE macro to replace hard-coded initialization of nr_tracepoints
for future changes.

Suggested-by: Namhyung Kim <namhyung@...nel.org>
Signed-off-by: Yang Jihong <yangjihong1@...wei.com>
---
 tools/perf/builtin-kwork.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/tools/perf/builtin-kwork.c b/tools/perf/builtin-kwork.c
index ff17711a554a..2143280c2e95 100644
--- a/tools/perf/builtin-kwork.c
+++ b/tools/perf/builtin-kwork.c
@@ -817,7 +817,7 @@ static void irq_work_name(struct kwork_work *work, char *buf, int len)
 static struct kwork_class kwork_irq = {
 	.name           = "irq",
 	.type           = KWORK_CLASS_IRQ,
-	.nr_tracepoints = 2,
+	.nr_tracepoints = ARRAY_SIZE(irq_tp_handlers),
 	.tp_handlers    = irq_tp_handlers,
 	.class_init     = irq_class_init,
 	.work_init      = irq_work_init,
@@ -938,7 +938,7 @@ static void softirq_work_name(struct kwork_work *work, char *buf, int len)
 static struct kwork_class kwork_softirq = {
 	.name           = "softirq",
 	.type           = KWORK_CLASS_SOFTIRQ,
-	.nr_tracepoints = 3,
+	.nr_tracepoints = ARRAY_SIZE(softirq_tp_handlers),
 	.tp_handlers    = softirq_tp_handlers,
 	.class_init     = softirq_class_init,
 	.work_init      = softirq_work_init,
@@ -1035,7 +1035,7 @@ static void workqueue_work_name(struct kwork_work *work, char *buf, int len)
 static struct kwork_class kwork_workqueue = {
 	.name           = "workqueue",
 	.type           = KWORK_CLASS_WORKQUEUE,
-	.nr_tracepoints = 3,
+	.nr_tracepoints = ARRAY_SIZE(workqueue_tp_handlers),
 	.tp_handlers    = workqueue_tp_handlers,
 	.class_init     = workqueue_class_init,
 	.work_init      = workqueue_work_init,
-- 
2.30.GIT

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ