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

9ae3a8
From a967318ce21d68d30afbb02bcd8b43dd7157916d Mon Sep 17 00:00:00 2001
9ae3a8
From: John Snow <jsnow@redhat.com>
9ae3a8
Date: Thu, 2 Aug 2018 15:53:36 +0200
9ae3a8
Subject: [PATCH 3/4] ide: avoid referencing NULL dev in rotational rate
9ae3a8
 setting
9ae3a8
9ae3a8
RH-Author: John Snow <jsnow@redhat.com>
9ae3a8
Message-id: <20180802155336.10347-4-jsnow@redhat.com>
9ae3a8
Patchwork-id: 81611
9ae3a8
O-Subject: [RHEL-7.6 qemu-kvm PATCH 3/3] ide: avoid referencing NULL dev in rotational rate setting
9ae3a8
Bugzilla: 1583807
9ae3a8
RH-Acked-by: Daniel P. Berrange <berrange@redhat.com>
9ae3a8
RH-Acked-by: Laszlo Ersek <lersek@redhat.com>
9ae3a8
RH-Acked-by: Thomas Huth <thuth@redhat.com>
9ae3a8
9ae3a8
From: "Daniel P. Berrange" <berrange@redhat.com>
9ae3a8
9ae3a8
The 'dev' variable can be NULL when the guest OS calls identify on an IDE
9ae3a8
unit that does not have a drive attached to it.
9ae3a8
9ae3a8
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
9ae3a8
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
9ae3a8
Message-id: 20171020091403.1479-1-berrange@redhat.com
9ae3a8
Signed-off-by: John Snow <jsnow@redhat.com>
9ae3a8
(cherry picked from commit 96f43c2b0a663f4789b51ed97297163321e7ba5e)
9ae3a8
Signed-off-by: John Snow <jsnow@redhat.com>
9ae3a8
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
9ae3a8
---
9ae3a8
 hw/ide/core.c | 4 +++-
9ae3a8
 1 file changed, 3 insertions(+), 1 deletion(-)
9ae3a8
9ae3a8
diff --git a/hw/ide/core.c b/hw/ide/core.c
9ae3a8
index aea2ff9..be6e0c9 100644
9ae3a8
--- a/hw/ide/core.c
9ae3a8
+++ b/hw/ide/core.c
9ae3a8
@@ -179,7 +179,9 @@ static void ide_identify(IDEState *s)
9ae3a8
     if (dev && dev->conf.discard_granularity) {
9ae3a8
         put_le16(p + 169, 1); /* TRIM support */
9ae3a8
     }
9ae3a8
-    put_le16(p + 217, dev->rotation_rate); /* Nominal media rotation rate */
9ae3a8
+    if (dev) {
9ae3a8
+        put_le16(p + 217, dev->rotation_rate); /* Nominal media rotation rate */
9ae3a8
+    }
9ae3a8
 
9ae3a8
     memcpy(s->identify_data, p, sizeof(s->identify_data));
9ae3a8
     s->identify_set = 1;
9ae3a8
-- 
9ae3a8
1.8.3.1
9ae3a8