aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenoƮt Canet <benoit.canet@irqsave.net>2014-04-12 22:59:50 +0200
committerPeter Maydell <peter.maydell@linaro.org>2014-04-14 13:23:53 +0100
commit940973ae0b45c9b6817bab8e4cf4df99a9ef83d7 (patch)
tree0099c715d94fbc919180f7b4e516287bd8cd5aff
parent590e5dd98fcc926cc3b63aad35aed79235ca4c2a (diff)
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: Benoit Canet <benoit@irqsave.net> Message-id: 1397336390-24664-1-git-send-email-benoit.canet@irqsave.net Reviewed-by: Markus Armbruster <armbru@redhat.com> Cc: qemu-stable@nongnu.org Acked-by: Kevin Wolf <kwolf@redhat.com> [PMM: tweaked commit message as per suggestions from Markus] Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-rw-r--r--hw/ide/core.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/hw/ide/core.c b/hw/ide/core.c
index e1dfe54df6..c943a4d764 100644
--- a/hw/ide/core.c
+++ b/hw/ide/core.c
@@ -1602,7 +1602,7 @@ static bool cmd_smart(IDEState *s, uint8_t cmd)
case 2: /* extended self test */
s->smart_selftest_count++;
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;