diff options
author | Kevin O'Connor <kevin@koconnor.net> | 2017-01-14 12:11:30 -0500 |
---|---|---|
committer | Kevin O'Connor <kevin@koconnor.net> | 2017-01-14 12:11:30 -0500 |
commit | 262ccbcf302f8dae0baccd1747406b18be7cd60e (patch) | |
tree | 61b66ac924b1c2fdb27e75e68ba6ee3ce89ef418 /src/avr/serial.c | |
parent | 756788511529b9da651c5f0af29251f83c5a2cd2 (diff) | |
download | kutter-262ccbcf302f8dae0baccd1747406b18be7cd60e.tar.gz kutter-262ccbcf302f8dae0baccd1747406b18be7cd60e.tar.xz kutter-262ccbcf302f8dae0baccd1747406b18be7cd60e.zip |
serial: Be careful with comparison of transmit_max to transmit_pos
There is a small possibility that a shutdown could occur between
clearing transmit_max and clearing transmit_pos - so make sure to
handle the case where transmit_pos > transmit_max.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'src/avr/serial.c')
-rw-r--r-- | src/avr/serial.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/avr/serial.c b/src/avr/serial.c index 8c0da553..0b5fea1f 100644 --- a/src/avr/serial.c +++ b/src/avr/serial.c @@ -115,7 +115,7 @@ char * console_get_output(uint8_t len) { uint8_t tpos = readb(&transmit_pos), tmax = readb(&transmit_max); - if (tpos == tmax) { + if (tpos >= tmax) { tpos = tmax = 0; writeb(&transmit_max, 0); writeb(&transmit_pos, 0); |