From: BenoƮt Canet Date: Sat, 12 Apr 2014 20:59:50 +0000 (+0200) Subject: ide: Correct improper smart self test counter reset in ide core. X-Git-Tag: qemu-xen-4.4.3-rc1~32 X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=29236c2ea0cc67fa831e2eb75ee729615c950751;p=qemu-upstream-4.4-testing.git 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 Message-id: 1397336390-24664-1-git-send-email-benoit.canet@irqsave.net Reviewed-by: Markus Armbruster Cc: qemu-stable@nongnu.org Acked-by: Kevin Wolf [PMM: tweaked commit message as per suggestions from Markus] Signed-off-by: Peter Maydell --- diff --git a/hw/ide/core.c b/hw/ide/core.c index a73af7252..3fe67caea 100644 --- a/hw/ide/core.c +++ b/hw/ide/core.c @@ -1601,7 +1601,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;