122 lines
3.2 KiB
Diff
122 lines
3.2 KiB
Diff
From 44bdefe0ef52ead10b51333d940d3adc45d60420 Mon Sep 17 00:00:00 2001
|
|
From: zhoukaiqi <zhoukaiqi@huawei.com>
|
|
Date: Fri, 5 Jul 2024 15:53:36 +0800
|
|
Subject: [PATCH] fix uninitialized PmuAttr attr
|
|
|
|
---
|
|
pmu/plugin/plugin_counting.c | 3 +++
|
|
pmu/plugin/plugin_netif_rx.c | 3 +++
|
|
pmu/plugin/plugin_sampling.c | 3 +++
|
|
pmu/plugin/plugin_spe.c | 3 +++
|
|
pmu/plugin/plugin_uncore.c | 3 +++
|
|
5 files changed, 15 insertions(+)
|
|
|
|
diff --git a/pmu/plugin/plugin_counting.c b/pmu/plugin/plugin_counting.c
|
|
index b0de581..39573fa 100644
|
|
--- a/pmu/plugin/plugin_counting.c
|
|
+++ b/pmu/plugin/plugin_counting.c
|
|
@@ -12,6 +12,7 @@
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <stdbool.h>
|
|
+#include <securec.h>
|
|
#include "pmu.h"
|
|
#include "pcerrc.h"
|
|
#include "interface.h"
|
|
@@ -50,6 +51,8 @@ static int counting_open()
|
|
char *evtList[1];
|
|
int pd;
|
|
|
|
+ (void)memset_s(&attr, sizeof(struct PmuAttr), 0, sizeof(struct PmuAttr));
|
|
+
|
|
evtList[0] = "cycles";
|
|
|
|
attr.evtList = evtList;
|
|
diff --git a/pmu/plugin/plugin_netif_rx.c b/pmu/plugin/plugin_netif_rx.c
|
|
index 717f091..78f52d2 100644
|
|
--- a/pmu/plugin/plugin_netif_rx.c
|
|
+++ b/pmu/plugin/plugin_netif_rx.c
|
|
@@ -12,6 +12,7 @@
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <stdbool.h>
|
|
+#include <securec.h>
|
|
#include "pmu.h"
|
|
#include "pcerrc.h"
|
|
#include "interface.h"
|
|
@@ -49,6 +50,8 @@ static int open()
|
|
char *evtList[1];
|
|
int pd;
|
|
|
|
+ (void)memset_s(&attr, sizeof(struct PmuAttr), 0, sizeof(struct PmuAttr));
|
|
+
|
|
evtList[0] = "net:netif_rx";
|
|
|
|
attr.evtList = evtList;
|
|
diff --git a/pmu/plugin/plugin_sampling.c b/pmu/plugin/plugin_sampling.c
|
|
index 2c9fc5c..35e5dfb 100644
|
|
--- a/pmu/plugin/plugin_sampling.c
|
|
+++ b/pmu/plugin/plugin_sampling.c
|
|
@@ -12,6 +12,7 @@
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <stdbool.h>
|
|
+#include <securec.h>
|
|
#include "pmu.h"
|
|
#include "pcerrc.h"
|
|
#include "interface.h"
|
|
@@ -50,6 +51,8 @@ static int sampling_open()
|
|
char *evtList[1];
|
|
int pd;
|
|
|
|
+ (void)memset_s(&attr, sizeof(struct PmuAttr), 0, sizeof(struct PmuAttr));
|
|
+
|
|
evtList[0] = "cycles";
|
|
|
|
attr.evtList = evtList;
|
|
diff --git a/pmu/plugin/plugin_spe.c b/pmu/plugin/plugin_spe.c
|
|
index da7f926..52c31c3 100644
|
|
--- a/pmu/plugin/plugin_spe.c
|
|
+++ b/pmu/plugin/plugin_spe.c
|
|
@@ -12,6 +12,7 @@
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <stdbool.h>
|
|
+#include <securec.h>
|
|
#include "pmu.h"
|
|
#include "pcerrc.h"
|
|
#include "interface.h"
|
|
@@ -49,6 +50,8 @@ static int spe_open()
|
|
struct PmuAttr attr;
|
|
int pd;
|
|
|
|
+ (void)memset_s(&attr, sizeof(struct PmuAttr), 0, sizeof(struct PmuAttr));
|
|
+
|
|
attr.evtList = NULL;
|
|
attr.numEvt = 0;
|
|
attr.pidList = NULL;
|
|
diff --git a/pmu/plugin/plugin_uncore.c b/pmu/plugin/plugin_uncore.c
|
|
index 4e4cea5..9b845db 100644
|
|
--- a/pmu/plugin/plugin_uncore.c
|
|
+++ b/pmu/plugin/plugin_uncore.c
|
|
@@ -12,6 +12,7 @@
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <stdbool.h>
|
|
+#include <securec.h>
|
|
#include "pmu.h"
|
|
#include "pcerrc.h"
|
|
#include "interface.h"
|
|
@@ -78,6 +79,8 @@ static int uncore_open()
|
|
evtList[i + hha_num * RX_OPS_NUM] = rx_ops_num[i].uncore_name;
|
|
}
|
|
|
|
+ (void)memset_s(&attr, sizeof(struct PmuAttr), 0, sizeof(struct PmuAttr));
|
|
+
|
|
attr.evtList = evtList;
|
|
attr.numEvt = hha_num * UNCORE_MAX;
|
|
attr.pidList = NULL;
|
|
--
|
|
2.27.0
|
|
|