qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] ppc: abort if compat property contains an unknown value
@ 2016-07-13 10:00 Greg Kurz
  2016-07-13 12:05 ` Thomas Huth
  2016-07-14  2:07 ` David Gibson
  0 siblings, 2 replies; 3+ messages in thread
From: Greg Kurz @ 2016-07-13 10:00 UTC (permalink / raw)
  To: David Gibson; +Cc: qemu-ppc, qemu-devel, Bharata B Rao

It is not possible to set the compat property to an unknown value with
powerpc_set_compat(). Something must have gone terribly wrong in QEMU,
if we detect an "Internal error" in powerpc_get_compat(). Let's abort then.

This patch also drops the "max_compat ? *max_compat : -1" construct. It is
useless since max_compat is dereferenced a few lines above.

Signed-off-by: Greg Kurz <groug@kaod.org>
---
 target-ppc/translate_init.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/target-ppc/translate_init.c b/target-ppc/translate_init.c
index 55688db9c9db..79c86c477878 100644
--- a/target-ppc/translate_init.c
+++ b/target-ppc/translate_init.c
@@ -8446,8 +8446,8 @@ static void powerpc_get_compat(Object *obj, Visitor *v, const char *name,
     case 0:
         break;
     default:
-        error_setg(errp, "Internal error: compat is set to %x",
-                   max_compat ? *max_compat : -1);
+        error_report("Internal error: compat is set to %x", *max_compat);
+        abort();
         break;
     }
 

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

* Re: [Qemu-devel] [PATCH] ppc: abort if compat property contains an unknown value
  2016-07-13 10:00 [Qemu-devel] [PATCH] ppc: abort if compat property contains an unknown value Greg Kurz
@ 2016-07-13 12:05 ` Thomas Huth
  2016-07-14  2:07 ` David Gibson
  1 sibling, 0 replies; 3+ messages in thread
From: Thomas Huth @ 2016-07-13 12:05 UTC (permalink / raw)
  To: qemu-devel

On 13.07.2016 12:00, Greg Kurz wrote:
> It is not possible to set the compat property to an unknown value with
> powerpc_set_compat(). Something must have gone terribly wrong in QEMU,
> if we detect an "Internal error" in powerpc_get_compat(). Let's abort then.
> 
> This patch also drops the "max_compat ? *max_compat : -1" construct. It is
> useless since max_compat is dereferenced a few lines above.
> 
> Signed-off-by: Greg Kurz <groug@kaod.org>
> ---
>  target-ppc/translate_init.c |    4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/target-ppc/translate_init.c b/target-ppc/translate_init.c
> index 55688db9c9db..79c86c477878 100644
> --- a/target-ppc/translate_init.c
> +++ b/target-ppc/translate_init.c
> @@ -8446,8 +8446,8 @@ static void powerpc_get_compat(Object *obj, Visitor *v, const char *name,
>      case 0:
>          break;
>      default:
> -        error_setg(errp, "Internal error: compat is set to %x",
> -                   max_compat ? *max_compat : -1);
> +        error_report("Internal error: compat is set to %x", *max_compat);
> +        abort();
>          break;
>      }

Since abort() never returns, you can now also remove the "break;"
statement here.

 Thomas

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

* Re: [Qemu-devel] [PATCH] ppc: abort if compat property contains an unknown value
  2016-07-13 10:00 [Qemu-devel] [PATCH] ppc: abort if compat property contains an unknown value Greg Kurz
  2016-07-13 12:05 ` Thomas Huth
@ 2016-07-14  2:07 ` David Gibson
  1 sibling, 0 replies; 3+ messages in thread
From: David Gibson @ 2016-07-14  2:07 UTC (permalink / raw)
  To: Greg Kurz; +Cc: qemu-ppc, qemu-devel, Bharata B Rao

[-- Attachment #1: Type: text/plain, Size: 1423 bytes --]

On Wed, Jul 13, 2016 at 12:00:17PM +0200, Greg Kurz wrote:
> It is not possible to set the compat property to an unknown value with
> powerpc_set_compat(). Something must have gone terribly wrong in QEMU,
> if we detect an "Internal error" in powerpc_get_compat(). Let's abort then.
> 
> This patch also drops the "max_compat ? *max_compat : -1" construct. It is
> useless since max_compat is dereferenced a few lines above.
> 
> Signed-off-by: Greg Kurz <groug@kaod.org>

Applied to ppc-for-2.7, thanks.

> ---
>  target-ppc/translate_init.c |    4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/target-ppc/translate_init.c b/target-ppc/translate_init.c
> index 55688db9c9db..79c86c477878 100644
> --- a/target-ppc/translate_init.c
> +++ b/target-ppc/translate_init.c
> @@ -8446,8 +8446,8 @@ static void powerpc_get_compat(Object *obj, Visitor *v, const char *name,
>      case 0:
>          break;
>      default:
> -        error_setg(errp, "Internal error: compat is set to %x",
> -                   max_compat ? *max_compat : -1);
> +        error_report("Internal error: compat is set to %x", *max_compat);
> +        abort();
>          break;
>      }
>  
> 

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

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

end of thread, other threads:[~2016-07-14  2:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-07-13 10:00 [Qemu-devel] [PATCH] ppc: abort if compat property contains an unknown value Greg Kurz
2016-07-13 12:05 ` Thomas Huth
2016-07-14  2:07 ` David Gibson

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).