mirror of
https://github.com/ipmitool/ipmitool.git
synced 2025-05-10 18:47:22 +00:00
ID:508 - Fix segfaults in dcmi command handlers
Some command lists were not terminated properly. This commit fixes that.
This commit is contained in:
parent
60723084e6
commit
6d9c540f6b
@ -74,6 +74,8 @@ static int ipmi_print_sensor_info(struct ipmi_intf *intf, uint16_t rec_id);
|
||||
* to change a lot of the code in the main(). *
|
||||
******************************************************************************/
|
||||
|
||||
#define DCMI_CMD_END { 0xFF, NULL, NULL }
|
||||
|
||||
/* Main set of DCMI commands */
|
||||
const struct dcmi_cmd dcmi_cmd_vals[] = {
|
||||
{ 0x00, "discover", " Used to discover supported DCMI capabilities" },
|
||||
@ -88,7 +90,7 @@ const struct dcmi_cmd dcmi_cmd_vals[] = {
|
||||
{ 0x09, "get_conf_param", " Get DCMI Config Parameters" },
|
||||
{ 0x0A, "set_conf_param", " Set DCMI Config Parameters" },
|
||||
{ 0x0B, "oob_discover", " Ping/Pong Message for DCMI Discovery" },
|
||||
{ 0xFF, NULL, NULL }
|
||||
DCMI_CMD_END
|
||||
};
|
||||
|
||||
/* get capabilites */
|
||||
@ -98,7 +100,7 @@ const struct dcmi_cmd dcmi_capable_vals[] = {
|
||||
"temperature attributes" },
|
||||
{ 0x03, "optional_attributes", " Lists power capabilities" },
|
||||
{ 0x04, "managebility access", " Lists OOB channel information" },
|
||||
{ 0xFF, NULL, NULL }
|
||||
DCMI_CMD_END
|
||||
};
|
||||
|
||||
/* platform capabilities
|
||||
@ -110,13 +112,13 @@ const struct dcmi_cmd dcmi_mandatory_platform_capabilities[] = {
|
||||
{ 0x02, "SEL logging available", "" },
|
||||
{ 0x03, "Chassis power available", "" },
|
||||
{ 0x04, "Temperature monitor available", "" },
|
||||
{ 0xFF, NULL, NULL }
|
||||
DCMI_CMD_END
|
||||
};
|
||||
|
||||
/* optional capabilities */
|
||||
const struct dcmi_cmd dcmi_optional_platform_capabilities[] = {
|
||||
{ 0x01, "Power management available", "" },
|
||||
{ 0xFF, NULL, NULL }
|
||||
DCMI_CMD_END
|
||||
};
|
||||
|
||||
/* access capabilties */
|
||||
@ -127,7 +129,7 @@ const struct dcmi_cmd dcmi_management_access_capabilities[] = {
|
||||
{ 0x04, "Out-of-band primary LAN channel available", "" },
|
||||
{ 0x05, "SOL enabled", "" },
|
||||
{ 0x06, "VLAN capable", "" },
|
||||
{ 0xFF, NULL, NULL }
|
||||
DCMI_CMD_END
|
||||
};
|
||||
|
||||
/* identification capabilities */
|
||||
@ -135,7 +137,7 @@ const struct dcmi_cmd dcmi_id_capabilities_vals[] = {
|
||||
{ 0x01, "GUID", "" },
|
||||
{ 0x02, "DHCP hostname", "" },
|
||||
{ 0x03, "Asset tag", "" },
|
||||
{ 0xFF, NULL, NULL }
|
||||
DCMI_CMD_END
|
||||
};
|
||||
|
||||
/* Configuration parameters*/
|
||||
@ -145,7 +147,7 @@ const struct dcmi_cmd dcmi_conf_param_vals[] = {
|
||||
{ 0x03, "init", "\t\tInitial timeout interval" },
|
||||
{ 0x04, "timeout", "\t\tServer contact timeout interval" },
|
||||
{ 0x05, "retry", "\t\tServer contact retry interval" },
|
||||
{ 0xFF, NULL, NULL }
|
||||
DCMI_CMD_END
|
||||
};
|
||||
|
||||
|
||||
@ -183,7 +185,7 @@ const struct dcmi_cmd dcmi_pwrmgmt_vals[] = {
|
||||
{ 0x02, "set_limit", " Set a power limit option" },
|
||||
{ 0x03, "activate", " Activate the set power limit" },
|
||||
{ 0x04, "deactivate", "Deactivate the set power limit" },
|
||||
{ 0xFF, NULL, NULL }
|
||||
DCMI_CMD_END
|
||||
};
|
||||
|
||||
/* set power limit commands */
|
||||
@ -192,7 +194,7 @@ const struct dcmi_cmd dcmi_pwrmgmt_set_usage_vals[] = {
|
||||
{ 0x01, "limit", " <number in Watts>" },
|
||||
{ 0x02, "correction", "<number in milliseconds>" },
|
||||
{ 0x03, "sample", " <number in seconds>" },
|
||||
{ 0xFF, NULL, NULL }
|
||||
DCMI_CMD_END
|
||||
};
|
||||
|
||||
/* power management/get action commands */
|
||||
@ -217,7 +219,7 @@ const struct dcmi_cmd dcmi_pwrmgmt_get_action_vals[] = {
|
||||
{ 0x10, "OEM reserved (10h)", ""},
|
||||
|
||||
{ 0x11, "Log Event to SEL", ""},
|
||||
{ 0xFF, NULL, NULL }
|
||||
DCMI_CMD_END
|
||||
};
|
||||
|
||||
/* power management/set action commands */
|
||||
@ -242,21 +244,21 @@ const struct dcmi_cmd dcmi_pwrmgmt_action_vals[] = {
|
||||
{ 0x0f, "oem_0f", "OEM reserved (0fh)"},
|
||||
{ 0x10, "oem_10", "OEM reserved (10h)"},
|
||||
|
||||
{ 0xFF, NULL, NULL }
|
||||
DCMI_CMD_END
|
||||
};
|
||||
|
||||
/* thermal policy action commands */
|
||||
const struct dcmi_cmd dcmi_thermalpolicy_vals[] = {
|
||||
{ 0x00, "get", "Get thermal policy" },
|
||||
{ 0x01, "set", "Set thermal policy" },
|
||||
{ 0xFF, NULL, NULL }
|
||||
DCMI_CMD_END
|
||||
};
|
||||
|
||||
/* thermal policy action commands */
|
||||
const struct dcmi_cmd dcmi_confparameters_vals[] = {
|
||||
{ 0x00, "get", "Get configuration parameters" },
|
||||
{ 0x01, "set", "Set configuration parameters" },
|
||||
{ 0xFF, NULL, NULL }
|
||||
DCMI_CMD_END
|
||||
};
|
||||
|
||||
/* entityIDs used in thermap policy */
|
||||
@ -325,20 +327,20 @@ const struct dcmi_cmd nm_cmd_vals[] = {
|
||||
{ 0x07, "reset", "Reset Statistics" },
|
||||
{ 0x08, "alert", "Set/Get/Clear Alert destination" },
|
||||
{ 0x09, "threshold", "Set/Get Alert Thresholds" },
|
||||
{ 0xFF, NULL, NULL },
|
||||
DCMI_CMD_END,
|
||||
};
|
||||
|
||||
const struct dcmi_cmd nm_ctl_cmds[] = {
|
||||
{ 0x01, "enable", " <control scope>" },
|
||||
{ 0x00, "disable", "<control scope>"},
|
||||
{ 0xFF, NULL, NULL },
|
||||
DCMI_CMD_END,
|
||||
};
|
||||
|
||||
const struct dcmi_cmd nm_ctl_domain[] = {
|
||||
{ 0x00, "global", "" },
|
||||
{ 0x02, "per_domain", "<platform|CPU|Memory> (default is platform)" },
|
||||
{ 0x04, "per_policy", "<0-7>" },
|
||||
{ 0xFF, NULL, NULL },
|
||||
DCMI_CMD_END,
|
||||
};
|
||||
|
||||
/* Node Manager Domain codes */
|
||||
@ -348,7 +350,7 @@ const struct dcmi_cmd nm_domain_vals[] = {
|
||||
{ 0x02, "Memory", "" },
|
||||
{ 0x03, "protection", "" },
|
||||
{ 0x04, "I/O", "" },
|
||||
{ 0xFF, NULL, NULL },
|
||||
DCMI_CMD_END,
|
||||
};
|
||||
|
||||
const struct dcmi_cmd nm_version_vals[] = {
|
||||
@ -357,7 +359,7 @@ const struct dcmi_cmd nm_version_vals[] = {
|
||||
{ 0x03, "2.0", "" },
|
||||
{ 0x04, "2.5", "" },
|
||||
{ 0x05, "3.0", "" },
|
||||
{ 0xFF, NULL, NULL },
|
||||
DCMI_CMD_END,
|
||||
};
|
||||
|
||||
const struct dcmi_cmd nm_capability_opts[] = {
|
||||
@ -366,7 +368,7 @@ const struct dcmi_cmd nm_capability_opts[] = {
|
||||
{ 0x03, "missing", "Missing Power reading trigger" },
|
||||
{ 0x04, "reset", "Time after Host reset trigger" },
|
||||
{ 0x05, "boot", "Boot time policy" },
|
||||
{ 0xFF, NULL, NULL },
|
||||
DCMI_CMD_END,
|
||||
};
|
||||
|
||||
const struct dcmi_cmd nm_policy_type_vals[] = {
|
||||
@ -375,13 +377,13 @@ const struct dcmi_cmd nm_policy_type_vals[] = {
|
||||
{ 0x02, "Missing Power reading trigger", "" },
|
||||
{ 0x03, "Time after Host reset trigger", "" },
|
||||
{ 0x04, "number of cores to disable at boot time", "" },
|
||||
{ 0xFF, NULL, NULL },
|
||||
DCMI_CMD_END,
|
||||
};
|
||||
|
||||
const struct dcmi_cmd nm_stats_opts[] = {
|
||||
{ 0x01, "domain", "<platform|CPU|Memory> (default is platform)" },
|
||||
{ 0x02, "policy_id", "<0-7>" },
|
||||
{ 0xFF, NULL, NULL },
|
||||
DCMI_CMD_END,
|
||||
};
|
||||
|
||||
const struct dcmi_cmd nm_stats_mode[] = {
|
||||
@ -395,7 +397,7 @@ const struct dcmi_cmd nm_stats_mode[] = {
|
||||
{ 0x1D, "cpu_throttling", "CPU throttling" },
|
||||
{ 0x1E, "mem_throttling", "memory throttling" },
|
||||
{ 0x1F, "comm_fail", "host communication failures" },
|
||||
{ 0xFF, NULL, NULL },
|
||||
DCMI_CMD_END,
|
||||
};
|
||||
|
||||
const struct dcmi_cmd nm_policy_action[] = {
|
||||
@ -403,7 +405,7 @@ const struct dcmi_cmd nm_policy_action[] = {
|
||||
{ 0x04, "add", "nm policy add policy_id <0-7> [domain <platform|CPU|Memory>] correction auto|soft|hard power <watts>|inlet <temp> trig_lim <param> stats <seconds> enable|disable" },
|
||||
{ 0x05, "remove", "nm policy remove policy_id <0-7> [domain <platform|CPU|Memory>]" },
|
||||
{ 0x06, "limiting", "nm policy limiting [domain <platform|CPU|Memory>]" },
|
||||
{ 0xFF, NULL, NULL },
|
||||
DCMI_CMD_END,
|
||||
};
|
||||
const struct dcmi_cmd nm_policy_options[] = {
|
||||
{ 0x01, "enable", "" },
|
||||
@ -417,7 +419,7 @@ const struct dcmi_cmd nm_policy_options[] = {
|
||||
{ 0x0B, "policy_id", "policy number" },
|
||||
{ 0x0C, "volatile", "save policy in volatiel memory" },
|
||||
{ 0x0D, "cores_off", "at boot time, disable N cores" },
|
||||
{ 0xFF, NULL, NULL },
|
||||
DCMI_CMD_END,
|
||||
};
|
||||
|
||||
/* if "trigger" command used from nm_policy_options */
|
||||
@ -426,7 +428,7 @@ const struct dcmi_cmd nm_trigger[] = {
|
||||
{ 0x01, "temp", "" },
|
||||
{ 0x02, "reset", "" },
|
||||
{ 0x03, "boot", "" },
|
||||
{ 0xFF, NULL, NULL },
|
||||
DCMI_CMD_END,
|
||||
};
|
||||
|
||||
/* if "correction" used from nm_policy_options */
|
||||
@ -434,7 +436,7 @@ const struct dcmi_cmd nm_correction[] = {
|
||||
{ 0x00, "auto", "" },
|
||||
{ 0x01, "soft", "" },
|
||||
{ 0x02, "hard", "" },
|
||||
{ 0xFF, NULL, NULL },
|
||||
DCMI_CMD_END,
|
||||
};
|
||||
|
||||
/* returned codes from get policy */
|
||||
@ -442,7 +444,7 @@ const struct dcmi_cmd nm_correction_vals[] = {
|
||||
{ 0x00, "no T-state use", "" },
|
||||
{ 0x01, "no T-state use", "" },
|
||||
{ 0x02, "use T-states", "" },
|
||||
{ 0xFF, NULL, NULL },
|
||||
DCMI_CMD_END,
|
||||
};
|
||||
|
||||
/* if "exception" used from nm_policy_options */
|
||||
@ -450,7 +452,7 @@ const struct dcmi_cmd nm_exception[] = {
|
||||
{ 0x00, "none", "" },
|
||||
{ 0x01, "alert", "" },
|
||||
{ 0x02, "shutdown", "" },
|
||||
{ 0xFF, NULL, NULL },
|
||||
DCMI_CMD_END,
|
||||
};
|
||||
|
||||
const struct dcmi_cmd nm_reset_mode[] = {
|
||||
@ -461,42 +463,46 @@ const struct dcmi_cmd nm_reset_mode[] = {
|
||||
{ 0x1D, "throttling", "" },
|
||||
{ 0x1E, "memory", "", },
|
||||
{ 0x1F, "comm", "" },
|
||||
{ 0xFF, NULL, NULL },
|
||||
DCMI_CMD_END,
|
||||
};
|
||||
|
||||
const struct dcmi_cmd nm_power_range[] = {
|
||||
{ 0x01, "domain", "domain <platform|CPU|Memory> (default is platform)" },
|
||||
{ 0x02, "min", " min <integer value>" },
|
||||
{ 0x03, "max", "max <integer value>" },
|
||||
{ 0xFF, NULL, NULL },
|
||||
DCMI_CMD_END,
|
||||
};
|
||||
|
||||
const struct dcmi_cmd nm_alert_opts[] = {
|
||||
{ 0x01, "set", "nm alert set chan <chan> dest <dest> string <string>" },
|
||||
{ 0x02, "get", "nm alert get" },
|
||||
{ 0x03, "clear", "nm alert clear dest <dest>" },
|
||||
DCMI_CMD_END,
|
||||
};
|
||||
|
||||
const struct dcmi_cmd nm_set_alert_param[] = {
|
||||
{ 0x01, "chan", "chan <channel>" },
|
||||
{ 0x02, "dest", "dest <destination>" },
|
||||
{ 0x03, "string", "string <string>" },
|
||||
DCMI_CMD_END,
|
||||
};
|
||||
|
||||
const struct dcmi_cmd nm_thresh_cmds[] = {
|
||||
{ 0x01, "set", "nm thresh set [domain <platform|CPU|Memory>] policy_id <policy> thresh_array" },
|
||||
{ 0x02, "get", "nm thresh get [domain <platform|CPU|Memory>] policy_id <policy>" },
|
||||
DCMI_CMD_END,
|
||||
};
|
||||
|
||||
const struct dcmi_cmd nm_thresh_param[] = {
|
||||
{ 0x01, "domain", "<platform|CPU|Memory> (default is platform)" },
|
||||
{ 0x02, "policy_id", "<0-7>" },
|
||||
{ 0xFF, NULL, NULL },
|
||||
DCMI_CMD_END,
|
||||
};
|
||||
|
||||
const struct dcmi_cmd nm_suspend_cmds[] = {
|
||||
{ 0x01, "set", "nm suspend set [domain <platform|CPU|Memory]> policy_id <policy> <start> <stop> <pattern>" },
|
||||
{ 0x02, "get", "nm suspend get [domain <platform|CPU|Memory]> policy_id <policy>" },
|
||||
DCMI_CMD_END,
|
||||
};
|
||||
|
||||
const struct valstr nm_ccode_vals[] = {
|
||||
|
Loading…
x
Reference in New Issue
Block a user