Skip to content

Commit

Permalink
Fix possible uninitialized access in eeprom_write.
Browse files Browse the repository at this point in the history
  • Loading branch information
whitequark committed May 18, 2018
1 parent 1303ee1 commit 4b1bc41
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions firmware/library/eeprom.c
Expand Up @@ -29,14 +29,14 @@ bool eeprom_read(uint8_t chip, uint16_t addr, uint8_t *buf, uint16_t len, bool d
bool eeprom_write(uint8_t chip, uint16_t addr, uint8_t *buf, uint16_t len, bool double_byte,
uint8_t timeout) {
uint8_t xfer_bytes[3];
uint16_t i;
uint16_t i = 0;
uint8_t j;
bool started = false;

if(!i2c_start(chip << 1))
goto stop;

for(i = 0; i < len; i++) {
for(; i < len; i++) {
if(double_byte) {
xfer_bytes[0] = addr >> 8;
xfer_bytes[1] = addr & 0xff;
Expand Down

0 comments on commit 4b1bc41

Please sign in to comment.