diff mbox

x86/vmx: fix compilation after 997382

Message ID 20170214103752.90366-1-roger.pau@citrix.com (mailing list archive)
State New, archived
Headers show

Commit Message

Roger Pau Monné Feb. 14, 2017, 10:37 a.m. UTC
997382 introduced the following errors:

intr.c:342:46: error: address of array 'vlapic->regs->data' will always evaluate to 'true'
      [-Werror,-Wpointer-bool-conversion]
                if ( vlapic && vlapic->regs->data )
                            ~~ ~~~~~~~~~~~~~~^~~~
intr.c:352:42: error: address of array 'pi_desc->pir' will always evaluate to 'true'
      [-Werror,-Wpointer-bool-conversion]
                if ( pi_desc && pi_desc->pir )
                             ~~ ~~~~~~~~~^~~
Both of those checks are done against static arrays, which doesn't seem to make
much sense, so just remove them.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
---
NB: maybe the first check should be against vlapic->regs?
---
Cc: Jun Nakajima <jun.nakajima@intel.com>
Cc: Kevin Tian <kevin.tian@intel.com>
Cc: Jan Beulich <jbeulich@suse.com>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>
Cc: Chao Gao <chao.gao@intel.com>
---
 xen/arch/x86/hvm/vmx/intr.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Jan Beulich Feb. 14, 2017, 10:46 a.m. UTC | #1
>>> On 14.02.17 at 11:37, <roger.pau@citrix.com> wrote:
> 997382 introduced the following errors:
> 
> intr.c:342:46: error: address of array 'vlapic->regs->data' will always 
> evaluate to 'true'
>       [-Werror,-Wpointer-bool-conversion]
>                 if ( vlapic && vlapic->regs->data )
>                             ~~ ~~~~~~~~~~~~~~^~~~
> intr.c:352:42: error: address of array 'pi_desc->pir' will always evaluate to 
> 'true'
>       [-Werror,-Wpointer-bool-conversion]
>                 if ( pi_desc && pi_desc->pir )
>                              ~~ ~~~~~~~~~^~~
> Both of those checks are done against static arrays, which doesn't seem to make
> much sense, so just remove them.

Darn, I had meant to check while massaging the patch, but then
forgot.

> Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
> ---
> NB: maybe the first check should be against vlapic->regs?

Yes, please. Or I can do this while committing. The subject, btw,
should probably include "clang", as neither I nor osstest have an
issue with gcc?

Jan
Roger Pau Monné Feb. 14, 2017, 10:55 a.m. UTC | #2
On Tue, Feb 14, 2017 at 03:46:37AM -0700, Jan Beulich wrote:
> >>> On 14.02.17 at 11:37, <roger.pau@citrix.com> wrote:
> > 997382 introduced the following errors:
> > 
> > intr.c:342:46: error: address of array 'vlapic->regs->data' will always 
> > evaluate to 'true'
> >       [-Werror,-Wpointer-bool-conversion]
> >                 if ( vlapic && vlapic->regs->data )
> >                             ~~ ~~~~~~~~~~~~~~^~~~
> > intr.c:352:42: error: address of array 'pi_desc->pir' will always evaluate to 
> > 'true'
> >       [-Werror,-Wpointer-bool-conversion]
> >                 if ( pi_desc && pi_desc->pir )
> >                              ~~ ~~~~~~~~~^~~
> > Both of those checks are done against static arrays, which doesn't seem to make
> > much sense, so just remove them.
> 
> Darn, I had meant to check while massaging the patch, but then
> forgot.
> 
> > Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
> > ---
> > NB: maybe the first check should be against vlapic->regs?
> 
> Yes, please. Or I can do this while committing. The subject, btw,
> should probably include "clang", as neither I nor osstest have an
> issue with gcc?

If you don't mind please change the check while committing, so that it's
against vlapic->regs. Regarding the subject, what about:

x86/vmx: fix compilation with clang after 997382

FWIW, neither the versions of clang in travis seem to pick this up:

https://travis-ci.org/xen-project/xen/builds/201180775

Thanks, Roger.
diff mbox

Patch

diff --git a/xen/arch/x86/hvm/vmx/intr.c b/xen/arch/x86/hvm/vmx/intr.c
index 1e17c4e..b9a02d1 100644
--- a/xen/arch/x86/hvm/vmx/intr.c
+++ b/xen/arch/x86/hvm/vmx/intr.c
@@ -339,7 +339,7 @@  void vmx_intr_assist(void)
                        current, intack.source, intack.vector, pt_vector);
 
                 vlapic = vcpu_vlapic(v);
-                if ( vlapic && vlapic->regs->data )
+                if ( vlapic )
                 {
                     word = (const void *)&vlapic->regs->data[APIC_IRR];
                     printk(XENLOG_ERR "vIRR:");
@@ -349,7 +349,7 @@  void vmx_intr_assist(void)
                 }
 
                 pi_desc = &v->arch.hvm_vmx.pi_desc;
-                if ( pi_desc && pi_desc->pir )
+                if ( pi_desc )
                 {
                     word = (const void *)&pi_desc->pir;
                     printk(XENLOG_ERR " PIR:");