mirror of https://github.com/ARMmbed/mbed-os.git
				
				
				
			SAM_CortexM0P HAL accesses uninitialized memory
Uses uninitialized memory in I2C, and accesses an out of band array in pwmoutpull/4852/head
							parent
							
								
									acdd7dd424
								
							
						
					
					
						commit
						f9d0304a81
					
				| 
						 | 
				
			
			@ -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);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue