Commit 940973ae authored by Benoît Canet's avatar Benoît Canet Committed by Peter Maydell

ide: Correct improper smart self test counter reset in ide core.

The SMART self test counter was incorrectly being reset to zero,
not 1. This had the effect that on every 21st SMART EXECUTE OFFLINE:
 * We would write off the beginning of a dynamically allocated buffer
 * We forgot the SMART history
Fix this.
Signed-off-by: default avatarBenoit Canet <>
Reviewed-by: default avatarMarkus Armbruster <>
Acked-by: default avatarKevin Wolf <>
[PMM: tweaked commit message as per suggestions from Markus]
Signed-off-by: default avatarPeter Maydell <>
parent 590e5dd9
......@@ -1602,7 +1602,7 @@ static bool cmd_smart(IDEState *s, uint8_t cmd)
case 2: /* extended self test */
if (s->smart_selftest_count > 21) {
s->smart_selftest_count = 0;
s->smart_selftest_count = 1;
n = 2 + (s->smart_selftest_count - 1) * 24;
s->smart_selftest_data[n] = s->sector;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment