aboutsummaryrefslogtreecommitdiff
path: root/hw/ipmi
diff options
context:
space:
mode:
authorStewart Smith <stewart@linux.vnet.ibm.com>2015-11-16 15:53:04 +1100
committerStewart Smith <stewart@linux.vnet.ibm.com>2015-11-16 15:53:04 +1100
commita652c33f21e49314f495796a1efbc3f6dc6329c1 (patch)
tree2c045da998a34071272a4fc0661154aaee143ca3 /hw/ipmi
parent4d5e0d83129c302a39036102fb04ab598ec92c1b (diff)
downloadskiboot-a652c33f21e49314f495796a1efbc3f6dc6329c1.zip
skiboot-a652c33f21e49314f495796a1efbc3f6dc6329c1.tar.gz
skiboot-a652c33f21e49314f495796a1efbc3f6dc6329c1.tar.bz2
assert IPMI sensors < max we support
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
Diffstat (limited to 'hw/ipmi')
-rw-r--r--hw/ipmi/ipmi-sensor.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/hw/ipmi/ipmi-sensor.c b/hw/ipmi/ipmi-sensor.c
index c8723ae..dd63986 100644
--- a/hw/ipmi/ipmi-sensor.c
+++ b/hw/ipmi/ipmi-sensor.c
@@ -25,7 +25,8 @@
#define FW_PROGRESS_SENSOR_TYPE 0x0F
#define BOOT_COUNT_SENSOR_TYPE 0xC3
-static int16_t sensors[255];
+#define MAX_IPMI_SENSORS 255
+static int16_t sensors[MAX_IPMI_SENSORS];
struct set_sensor_req {
u8 sensor_number;
@@ -38,6 +39,7 @@ struct set_sensor_req {
uint8_t ipmi_get_sensor_number(uint8_t sensor_type)
{
+ assert(sensor_type < MAX_IPMI_SENSORS);
return sensors[sensor_type];
}
@@ -125,6 +127,7 @@ void ipmi_sensor_init(void)
}
num = (uint8_t)dt_property_get_cell(num_prop, 0);
type = (uint8_t)dt_property_get_cell(type_prop, 0);
+ assert(type < MAX_IPMI_SENSORS);
sensors[type] = num;
}
}