The last element on list must be IBPI_PATTERN_UNKNOWN, otherwise we can read out of bound memory. It is possible now when not supported pattern is requested with --set-slot for VMD. In my case it doesn't produce issue because it reads zeros from memory after the array. Fix that for vmd controller by adding IBPI_PATTERN_UNKNOWN element to array with no value. Add validation of returned value where necessary.
To avoid such issues appropriative assert is added.
List of changes:
Rename ibpi_value to ibpi2value to make it more meaningful.
Change both ibpi and value to unsigned. Enum is started from 0 so it is safe.
Return ibpi2value struct instead of raw enum/value.
Create one get_ibpi_value() function.
Pass size to get_ibpi_value() and add assert.
Move attention_get to vmdssd to avoid extern ibpi_to_attention[].
Generate compar* functions.
fix for set_slot_npem in get_pci_dev(), use basename().
Update descriptions.
Use ibpi2value in amd_ipmi
Use ibpi2value in ahci
Use ibpi2value in dellssd
Now caller can verify what was returned and react accordingly if needed.
The last element on list must be IBPI_PATTERN_UNKNOWN, otherwise we can read out of bound memory. It is possible now when not supported pattern is requested with --set-slot for VMD. In my case it doesn't produce issue because it reads zeros from memory after the array. Fix that for vmd controller by adding IBPI_PATTERN_UNKNOWN element to array with no value. Add validation of returned value where necessary.
To avoid such issues appropriative assert is added.
List of changes:
Now caller can verify what was returned and react accordingly if needed.
Signed-off-by: Mariusz Tkaczyk mariusz.tkaczyk@linux.intel.com