ti_adc108s102: validate num_entries
num_entries can be as large as 255. However, based on the _ti_adc108s102 implementation, num_entries must be less than ADC108S102_CMD_BUFFER_SIZE or the cmd_buffer[] and sampling_buffer[] arrays in the data struct could overflow. Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
This commit is contained in:
parent
97ccf99b9b
commit
5dc2ab4f47
1 changed files with 4 additions and 0 deletions
|
@ -134,6 +134,10 @@ static inline int _verify_entries(struct adc_seq_table *seq_table)
|
|||
u32_t chans_set = 0;
|
||||
int i;
|
||||
|
||||
if (seq_table->num_entries >= ADC108S102_CMD_BUFFER_SIZE) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
for (i = 0; i < seq_table->num_entries; i++) {
|
||||
entry = &seq_table->entries[i];
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue