qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH for 2.0] ide: Correct improper smart self test c


From: Markus Armbruster
Subject: Re: [Qemu-devel] [PATCH for 2.0] ide: Correct improper smart self test counter reset in ide core.
Date: Mon, 14 Apr 2014 10:56:25 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2 (gnu/linux)

Benoît Canet <address@hidden> writes:

> The counter being reseted to zero make the array index negative.
> Reset it to 1.
>
> Signed-off-by: Benoit Canet <address@hidden>
> ---
>  hw/ide/core.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/hw/ide/core.c b/hw/ide/core.c
> index e1dfe54..c943a4d 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;

Good catch.

Commit message could use some love, though.  On every 21st SMART EXECUTE
OFFLINE:

* We write before a dynamically allocated buffer

  Your diff's context has one of the writes.

* We forget SMART history

  See the s->smart_selftest_count == 0 special cases in SMART READ DATA
  and SMART READ LOG.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]