From: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
To: qemu-devel@nongnu.org
Cc: peter.maydell@linaro.org, xen-devel@lists.xensource.com,
James Harper <james@ejbdigital.com.au>,
James Harper <james.harper@ejbdigital.com.au>,
Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Subject: [Qemu-devel] [PULL 2/2] fix off-by-one error in pci_piix3_xen_ide_unplug
Date: Thu, 30 Oct 2014 14:22:27 +0000 [thread overview]
Message-ID: <1414678947-8607-2-git-send-email-stefano.stabellini@eu.citrix.com> (raw)
In-Reply-To: <alpine.DEB.2.02.1410301417070.22875@kaball.uk.xensource.com>
From: James Harper <james@ejbdigital.com.au>
Fix off-by-one error when unplugging disks, which would otherwise leave the last ATA disk plugged, with obvious consequences. Also rewrite loop to be more readable.
Signed-off-by: James Harper <james.harper@ejbdigital.com.au>
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
---
hw/ide/piix.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/hw/ide/piix.c b/hw/ide/piix.c
index 574b9c1..b0172fb 100644
--- a/hw/ide/piix.c
+++ b/hw/ide/piix.c
@@ -171,11 +171,11 @@ int pci_piix3_xen_ide_unplug(DeviceState *dev)
{
PCIIDEState *pci_ide;
DriveInfo *di;
- int i = 0;
+ int i;
pci_ide = PCI_IDE(dev);
- for (; i < 3; i++) {
+ for (i = 0; i < 4; i++) {
di = drive_get_by_index(IF_IDE, i);
if (di != NULL && !di->media_cd) {
BlockBackend *blk = blk_by_legacy_dinfo(di);
--
1.7.10.4
next prev parent reply other threads:[~2014-10-31 15:47 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-30 14:21 [Qemu-devel] [PULL 0/2] Xen tree 2014-10-30 Stefano Stabellini
2014-10-30 14:22 ` [Qemu-devel] [PULL 1/2] xen-hvm.c: Add support for Xen access to vmport Stefano Stabellini
2014-10-30 14:22 ` Stefano Stabellini [this message]
2014-10-30 14:35 ` [Qemu-devel] [Xen-devel] [PULL 0/2] Xen tree 2014-10-30 Xu, Quan
2014-10-31 17:48 ` Stefano Stabellini
2014-10-31 10:38 ` [Qemu-devel] " Peter Maydell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1414678947-8607-2-git-send-email-stefano.stabellini@eu.citrix.com \
--to=stefano.stabellini@eu.citrix.com \
--cc=james.harper@ejbdigital.com.au \
--cc=james@ejbdigital.com.au \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=xen-devel@lists.xensource.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).