[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 2/2] ide: avoid referencing NULL dev in rotational ra
From: |
John Snow |
Subject: |
[Qemu-devel] [PULL 2/2] ide: avoid referencing NULL dev in rotational rate setting |
Date: |
Tue, 31 Oct 2017 19:02:06 -0400 |
From: "Daniel P. Berrange" <address@hidden>
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 <address@hidden>
Reviewed-by: Stefan Hajnoczi <address@hidden>
Message-id: address@hidden
Signed-off-by: John Snow <address@hidden>
---
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