From: John Snow <jsnow@redhat.com>
To: qemu-devel@nongnu.org
Cc: peter.maydell@linaro.org, jsnow@redhat.com,
"Daniel P. Berrange" <berrange@redhat.com>
Subject: [Qemu-devel] [PULL 2/2] ide: avoid referencing NULL dev in rotational rate setting
Date: Tue, 31 Oct 2017 19:02:06 -0400 [thread overview]
Message-ID: <20171031230206.32731-3-jsnow@redhat.com> (raw)
In-Reply-To: <20171031230206.32731-1-jsnow@redhat.com>
From: "Daniel P. Berrange" <berrange@redhat.com>
The 'dev' variable can be NULL when the guest OS calls identify on an IDE
unit that does not have a drive attached to it.
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-id: 20171020091403.1479-1-berrange@redhat.com
Signed-off-by: John Snow <jsnow@redhat.com>
---
hw/ide/core.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/hw/ide/core.c b/hw/ide/core.c
index a04766a..471d0c9 100644
--- a/hw/ide/core.c
+++ b/hw/ide/core.c
@@ -208,7 +208,9 @@ static void ide_identify(IDEState *s)
if (dev && dev->conf.discard_granularity) {
put_le16(p + 169, 1); /* TRIM support */
}
- put_le16(p + 217, dev->rotation_rate); /* Nominal media rotation rate */
+ if (dev) {
+ put_le16(p + 217, dev->rotation_rate); /* Nominal media rotation rate */
+ }
ide_identify_size(s);
s->identify_set = 1;
--
2.9.5
next prev parent reply other threads:[~2017-10-31 23:02 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-31 23:02 [Qemu-devel] [PULL 0/2] Ide patches John Snow
2017-10-31 23:02 ` [Qemu-devel] [PULL 1/2] hw/ide/ahci: Move allwinner code into a separate file John Snow
2017-10-31 23:02 ` John Snow [this message]
2017-11-02 11:47 ` [Qemu-devel] [PULL 0/2] Ide patches 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=20171031230206.32731-3-jsnow@redhat.com \
--to=jsnow@redhat.com \
--cc=berrange@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
/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).