Set the size of the channel property arrays
Arrays which don't initialize the last elements of the enumeration are shorter and will cause a buffer overflow when read in a loop.
This commit is contained in:
parent
8a92023cf3
commit
c2b6bfd3a8
@ -18,7 +18,7 @@
|
|||||||
#include "value.h"
|
#include "value.h"
|
||||||
|
|
||||||
static const char chan_fmt[] = "cpu%ld.%s";
|
static const char chan_fmt[] = "cpu%ld.%s";
|
||||||
static const char *chan_name[] = {
|
static const char *chan_name[CPU_CHAN_MAX] = {
|
||||||
[CPU_CHAN_NRUN] = "nrunning",
|
[CPU_CHAN_NRUN] = "nrunning",
|
||||||
[CPU_CHAN_PID] = "pid_running",
|
[CPU_CHAN_PID] = "pid_running",
|
||||||
[CPU_CHAN_TID] = "tid_running",
|
[CPU_CHAN_TID] = "tid_running",
|
||||||
@ -26,7 +26,7 @@ static const char *chan_name[] = {
|
|||||||
[CPU_CHAN_THACT] = "th_active",
|
[CPU_CHAN_THACT] = "th_active",
|
||||||
};
|
};
|
||||||
|
|
||||||
static int chan_type[] = {
|
static int chan_type[CPU_CHAN_MAX] = {
|
||||||
[CPU_CHAN_PID] = PRV_CPU_PID,
|
[CPU_CHAN_PID] = PRV_CPU_PID,
|
||||||
[CPU_CHAN_TID] = PRV_CPU_TID,
|
[CPU_CHAN_TID] = PRV_CPU_TID,
|
||||||
[CPU_CHAN_NRUN] = PRV_CPU_NRUN,
|
[CPU_CHAN_NRUN] = PRV_CPU_NRUN,
|
||||||
@ -34,7 +34,7 @@ static int chan_type[] = {
|
|||||||
[CPU_CHAN_THACT] = -1,
|
[CPU_CHAN_THACT] = -1,
|
||||||
};
|
};
|
||||||
|
|
||||||
static long prv_flags[] = {
|
static long prv_flags[CPU_CHAN_MAX] = {
|
||||||
[CPU_CHAN_NRUN] = PRV_ZERO,
|
[CPU_CHAN_NRUN] = PRV_ZERO,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -40,7 +40,7 @@ static const int chan_stack[CH_MAX] = {
|
|||||||
|
|
||||||
/* ----------------- pvt ------------------ */
|
/* ----------------- pvt ------------------ */
|
||||||
|
|
||||||
static const int pvt_type[] = {
|
static const int pvt_type[CH_MAX] = {
|
||||||
[CH_CS] = PRV_KERNEL_CS,
|
[CH_CS] = PRV_KERNEL_CS,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -65,7 +65,7 @@ static const int chan_dup[CH_MAX] = {
|
|||||||
|
|
||||||
/* ----------------- pvt ------------------ */
|
/* ----------------- pvt ------------------ */
|
||||||
|
|
||||||
static const int pvt_type[] = {
|
static const int pvt_type[CH_MAX] = {
|
||||||
[CH_TASKID] = PRV_NANOS6_TASKID,
|
[CH_TASKID] = PRV_NANOS6_TASKID,
|
||||||
[CH_TYPE] = PRV_NANOS6_TYPE,
|
[CH_TYPE] = PRV_NANOS6_TYPE,
|
||||||
[CH_SUBSYSTEM] = PRV_NANOS6_SUBSYSTEM,
|
[CH_SUBSYSTEM] = PRV_NANOS6_SUBSYSTEM,
|
||||||
|
@ -46,7 +46,7 @@ static const int chan_stack[CH_MAX] = {
|
|||||||
|
|
||||||
/* ----------------- pvt ------------------ */
|
/* ----------------- pvt ------------------ */
|
||||||
|
|
||||||
static const int pvt_type[] = {
|
static const int pvt_type[CH_MAX] = {
|
||||||
[CH_SUBSYSTEM] = PRV_NODES_SUBSYSTEM,
|
[CH_SUBSYSTEM] = PRV_NODES_SUBSYSTEM,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -61,7 +61,7 @@ static const int chan_dup[CH_MAX] = {
|
|||||||
|
|
||||||
/* ----------------- pvt ------------------ */
|
/* ----------------- pvt ------------------ */
|
||||||
|
|
||||||
static const int pvt_type[] = {
|
static const int pvt_type[CH_MAX] = {
|
||||||
[CH_TASKID] = PRV_NOSV_TASKID,
|
[CH_TASKID] = PRV_NOSV_TASKID,
|
||||||
[CH_TYPE] = PRV_NOSV_TYPE,
|
[CH_TYPE] = PRV_NOSV_TYPE,
|
||||||
[CH_APPID] = PRV_NOSV_APPID,
|
[CH_APPID] = PRV_NOSV_APPID,
|
||||||
|
@ -40,7 +40,7 @@ static const int chan_stack[CH_MAX] = { 0 };
|
|||||||
|
|
||||||
/* ----------------- pvt ------------------ */
|
/* ----------------- pvt ------------------ */
|
||||||
|
|
||||||
static const int pvt_type[] = {
|
static const int pvt_type[CH_MAX] = {
|
||||||
[CH_FLUSH] = PRV_OVNI_FLUSH,
|
[CH_FLUSH] = PRV_OVNI_FLUSH,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -19,19 +19,19 @@
|
|||||||
struct proc;
|
struct proc;
|
||||||
|
|
||||||
static const char chan_fmt[] = "thread%lu.%s";
|
static const char chan_fmt[] = "thread%lu.%s";
|
||||||
static const char *chan_name[] = {
|
static const char *chan_name[TH_CHAN_MAX] = {
|
||||||
[TH_CHAN_CPU] = "cpu_gindex",
|
[TH_CHAN_CPU] = "cpu_gindex",
|
||||||
[TH_CHAN_TID] = "tid_active",
|
[TH_CHAN_TID] = "tid_active",
|
||||||
[TH_CHAN_STATE] = "state",
|
[TH_CHAN_STATE] = "state",
|
||||||
};
|
};
|
||||||
|
|
||||||
static const int chan_type[] = {
|
static const int chan_type[TH_CHAN_MAX] = {
|
||||||
[TH_CHAN_CPU] = PRV_THREAD_CPU,
|
[TH_CHAN_CPU] = PRV_THREAD_CPU,
|
||||||
[TH_CHAN_TID] = PRV_THREAD_TID,
|
[TH_CHAN_TID] = PRV_THREAD_TID,
|
||||||
[TH_CHAN_STATE] = PRV_THREAD_STATE,
|
[TH_CHAN_STATE] = PRV_THREAD_STATE,
|
||||||
};
|
};
|
||||||
|
|
||||||
static const long prv_flags[] = {
|
static const long prv_flags[TH_CHAN_MAX] = {
|
||||||
/* Add one to the zero-based cpu gindex */
|
/* Add one to the zero-based cpu gindex */
|
||||||
[TH_CHAN_CPU] = PRV_NEXT,
|
[TH_CHAN_CPU] = PRV_NEXT,
|
||||||
|
|
||||||
@ -40,7 +40,7 @@ static const long prv_flags[] = {
|
|||||||
[TH_CHAN_STATE] = PRV_SKIPDUP,
|
[TH_CHAN_STATE] = PRV_SKIPDUP,
|
||||||
};
|
};
|
||||||
|
|
||||||
static const char *pvt_name[] = {
|
static const char *pvt_name[TH_CHAN_MAX] = {
|
||||||
[TH_CHAN_CPU] = "Thread: CPU affinity",
|
[TH_CHAN_CPU] = "Thread: CPU affinity",
|
||||||
[TH_CHAN_TID] = "Thread: TID of the ACTIVE thread",
|
[TH_CHAN_TID] = "Thread: TID of the ACTIVE thread",
|
||||||
[TH_CHAN_STATE] = "Thread: thread state",
|
[TH_CHAN_STATE] = "Thread: thread state",
|
||||||
|
Loading…
Reference in New Issue
Block a user