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

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