SAM_CortexM0P HAL accesses uninitialized memory

Uses uninitialized memory in I2C, and accesses an out of band array in pwmout
pull/4852/head
Jan Jongboom 2017-08-03 14:51:04 +02:00
parent acdd7dd424
commit f9d0304a81
2 changed files with 2 additions and 2 deletions

View File

@ -173,7 +173,7 @@ void i2c_frequency(i2c_t *obj, int hz)
int32_t baud_rate;
int32_t tmp_baud;
int32_t tmp_baud_hs;
enum status_code tmp_status_code;
enum status_code tmp_status_code = STATUS_OK;
/* Sanity check arguments */
MBED_ASSERT(obj);

View File

@ -60,7 +60,7 @@ static void pwmout_set_period(pwmout_t* obj, int period_us)
freq_hz = system_gclk_gen_get_hz(obj->clock_source);
for (i=0; i<sizeof(tcc_prescaler); i++) {
for (i=0; i<sizeof(tcc_prescaler) / sizeof(tcc_prescaler[0]); i++) {
div_freq = freq_hz >> tcc_prescaler[i];
if (!div_freq) break;
us_per_cycle = 1000000.00 / div_freq;