diff options
author | Stewart Smith <stewart@linux.vnet.ibm.com> | 2015-11-16 15:53:04 +1100 |
---|---|---|
committer | Stewart Smith <stewart@linux.vnet.ibm.com> | 2015-11-16 15:53:04 +1100 |
commit | a652c33f21e49314f495796a1efbc3f6dc6329c1 (patch) | |
tree | 2c045da998a34071272a4fc0661154aaee143ca3 /hw/ipmi | |
parent | 4d5e0d83129c302a39036102fb04ab598ec92c1b (diff) | |
download | skiboot-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.c | 5 |
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; } } |