]> git.proxmox.com Git - qemu.git/commit
ide: Fix error messages from static code analysis (no real error)
authorStefan Weil <sw@weilnetz.de>
Mon, 3 Sep 2012 20:13:56 +0000 (22:13 +0200)
committerMichael Roth <mdroth@linux.vnet.ibm.com>
Fri, 12 Oct 2012 02:44:16 +0000 (21:44 -0500)
commit3900d1d99267f16710762786c8e50ca83923bda0
tree424249d1c406c6a7a8959afabd0592c04e9a40ef
parent1fce4135f33e748980d9f1fa2fe79a19fcf57289
ide: Fix error messages from static code analysis (no real error)

Report from smatch:
hw/ide/core.c:1472 ide_exec_cmd(423) error: buffer overflow 'smart_attributes' 8 <= 29
hw/ide/core.c:1474 ide_exec_cmd(425) error: buffer overflow 'smart_attributes' 8 <= 29
hw/ide/core.c:1475 ide_exec_cmd(426) error: buffer overflow 'smart_attributes' 8 <= 29
...

The upper limit of 30 was never reached because both for loops terminated
when 'smart_attributes' reached end of list, so there was no real buffer
overflow.

Nevertheless, changing the code not only fixes the error report, but also
reduces the size of smart_attributes and simplifies the for loops.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
(cherry picked from commit 1e53537fdaa4657d11f130a0f2673fcfb1956381)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
hw/ide/core.c