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

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