qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] ide: avoid referencing NULL dev in rotational rate setting
@ 2017-10-20  9:14 Daniel P. Berrange
  2017-10-20  9:34 ` [Qemu-devel] [Qemu-block] " Stefan Hajnoczi
  2017-10-24  7:43 ` [Qemu-devel] " Daniel P. Berrange
  0 siblings, 2 replies; 4+ messages in thread
From: Daniel P. Berrange @ 2017-10-20  9:14 UTC (permalink / raw)
  To: qemu-devel; +Cc: Paolo Bonzini, qemu-block, Kevin Wolf, Daniel P. Berrange

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 <berrange@redhat.com>
---
 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 a04766aee7..471d0c928b 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.13.6

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] [Qemu-block] [PATCH] ide: avoid referencing NULL dev in rotational rate setting
  2017-10-20  9:14 [Qemu-devel] [PATCH] ide: avoid referencing NULL dev in rotational rate setting Daniel P. Berrange
@ 2017-10-20  9:34 ` Stefan Hajnoczi
  2017-10-24  7:43 ` [Qemu-devel] " Daniel P. Berrange
  1 sibling, 0 replies; 4+ messages in thread
From: Stefan Hajnoczi @ 2017-10-20  9:34 UTC (permalink / raw)
  To: Daniel P. Berrange; +Cc: qemu-devel, Kevin Wolf, Paolo Bonzini, qemu-block

On Fri, Oct 20, 2017 at 10:14:03AM +0100, Daniel P. Berrange wrote:
> 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 <berrange@redhat.com>
> ---
>  hw/ide/core.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)

Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] [PATCH] ide: avoid referencing NULL dev in rotational rate setting
  2017-10-20  9:14 [Qemu-devel] [PATCH] ide: avoid referencing NULL dev in rotational rate setting Daniel P. Berrange
  2017-10-20  9:34 ` [Qemu-devel] [Qemu-block] " Stefan Hajnoczi
@ 2017-10-24  7:43 ` Daniel P. Berrange
  2017-10-24 12:20   ` [Qemu-devel] [Qemu-block] " Stefan Hajnoczi
  1 sibling, 1 reply; 4+ messages in thread
From: Daniel P. Berrange @ 2017-10-24  7:43 UTC (permalink / raw)
  To: qemu-devel, John Snow; +Cc: Paolo Bonzini, qemu-block, Kevin Wolf

CC John

On Fri, Oct 20, 2017 at 10:14:03AM +0100, Daniel P. Berrange wrote:
> 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 <berrange@redhat.com>
> ---
>  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 a04766aee7..471d0c928b 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.13.6
> 

Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] [Qemu-block] [PATCH] ide: avoid referencing NULL dev in rotational rate setting
  2017-10-24  7:43 ` [Qemu-devel] " Daniel P. Berrange
@ 2017-10-24 12:20   ` Stefan Hajnoczi
  0 siblings, 0 replies; 4+ messages in thread
From: Stefan Hajnoczi @ 2017-10-24 12:20 UTC (permalink / raw)
  To: Daniel P. Berrange
  Cc: qemu-devel, John Snow, Kevin Wolf, Paolo Bonzini, qemu-block

On Tue, Oct 24, 2017 at 08:43:24AM +0100, Daniel P. Berrange wrote:
> CC John

Feel free to ping me if John doesn't respond by next Wednesday and I'll
merge this trivial fix.

Stefan

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-10-24 12:28 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-10-20  9:14 [Qemu-devel] [PATCH] ide: avoid referencing NULL dev in rotational rate setting Daniel P. Berrange
2017-10-20  9:34 ` [Qemu-devel] [Qemu-block] " Stefan Hajnoczi
2017-10-24  7:43 ` [Qemu-devel] " Daniel P. Berrange
2017-10-24 12:20   ` [Qemu-devel] [Qemu-block] " Stefan Hajnoczi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).