Blame SOURCES/kvm-ide-avoid-referencing-NULL-dev-in-rotational-rate-se.patch

4a2fec
From 565928c4292fcc32ecb34c1516283929d7fcaf90 Mon Sep 17 00:00:00 2001
4a2fec
From: "Daniel P. Berrange" <berrange@redhat.com>
4a2fec
Date: Wed, 29 Nov 2017 14:26:06 +0100
4a2fec
Subject: [PATCH 20/21] ide: avoid referencing NULL dev in rotational rate
4a2fec
 setting
4a2fec
4a2fec
RH-Author: Daniel P. Berrange <berrange@redhat.com>
4a2fec
Message-id: <20171129142606.15965-4-berrange@redhat.com>
4a2fec
Patchwork-id: 77972
4a2fec
O-Subject: [PATCH RHV-7.5 qemu-kvm-rhev 3/3] ide: avoid referencing NULL dev in rotational rate setting
4a2fec
Bugzilla: 1498042
4a2fec
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
4a2fec
RH-Acked-by: John Snow <jsnow@redhat.com>
4a2fec
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
4a2fec
4a2fec
The 'dev' variable can be NULL when the guest OS calls identify on an IDE
4a2fec
unit that does not have a drive attached to it.
4a2fec
4a2fec
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
4a2fec
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
4a2fec
Message-id: 20171020091403.1479-1-berrange@redhat.com
4a2fec
Signed-off-by: John Snow <jsnow@redhat.com>
4a2fec
(cherry picked from commit 96f43c2b0a663f4789b51ed97297163321e7ba5e)
4a2fec
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
4a2fec
---
4a2fec
 hw/ide/core.c | 4 +++-
4a2fec
 1 file changed, 3 insertions(+), 1 deletion(-)
4a2fec
4a2fec
diff --git a/hw/ide/core.c b/hw/ide/core.c
4a2fec
index 11986e3..506e8ed 100644
4a2fec
--- a/hw/ide/core.c
4a2fec
+++ b/hw/ide/core.c
4a2fec
@@ -191,7 +191,9 @@ static void ide_identify(IDEState *s)
4a2fec
     if (dev && dev->conf.discard_granularity) {
4a2fec
         put_le16(p + 169, 1); /* TRIM support */
4a2fec
     }
4a2fec
-    put_le16(p + 217, dev->rotation_rate); /* Nominal media rotation rate */
4a2fec
+    if (dev) {
4a2fec
+        put_le16(p + 217, dev->rotation_rate); /* Nominal media rotation rate */
4a2fec
+    }
4a2fec
 
4a2fec
     ide_identify_size(s);
4a2fec
     s->identify_set = 1;
4a2fec
-- 
4a2fec
1.8.3.1
4a2fec