Skip to contentSkip to conversation

hw/i386/intel_iommu.c:902: wrong logical operator ?

Qemu-devel dcb 1 participant 2 messages Oct 17, 2014 – Jun 23, 2016

lore
Share & tools
lore

dcb

author
#0 lore raw

Public bug reported:

/home/dcb/qemu/trunk/qemu/hw/i386/intel_iommu.c:902:5: error: logical ‘and’ applied to non-boolean constant [-Werror=logical-op]

     pvtd_as = s->address_spaces[VTD_SID_TO_BUS(source_id)];
     ^
$ fgrep VTD_SID_TO_BUS `find . -name \*.h -print`
./include/hw/i386/intel_iommu.h:#define VTD_SID_TO_BUS(sid)         (((sid) >> 8) && 0xff)
$ 

Sounds to me like

#define VTD_SID_TO_BUS(sid) (((sid) >> 8) & 0xff)

would be better.

** Affects: qemu
Importance: Undecided
Status: New

Signature · 27 lines
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1382477

Title:
  hw/i386/intel_iommu.c:902: wrong logical operator ?

Status in QEMU:
  New

Bug description:
  /home/dcb/qemu/trunk/qemu/hw/i386/intel_iommu.c:902:5: error: logical ‘and’ applied to non-boolean constant [-Werror=logical-op]
       pvtd_as = s->address_spaces[VTD_SID_TO_BUS(source_id)];
       ^

  $ fgrep VTD_SID_TO_BUS `find . -name \*.h -print`
  ./include/hw/i386/intel_iommu.h:#define VTD_SID_TO_BUS(sid)         (((sid) >> 8) && 0xff)
  $ 

  Sounds to me like

  #define VTD_SID_TO_BUS(sid)         (((sid) >> 8) & 0xff)

  would be better.

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1382477/+subscriptions
author
#1 lore raw

Fix has been included here:
http://git.qemu.org/?p=qemu.git;a=commitdiff;h=1e06f131fd9a44dd4af

** Changed in: qemu
Status: New => Fix Released

Signature · 27 lines
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1382477

Title:
  hw/i386/intel_iommu.c:902: wrong logical operator ?

Status in QEMU:
  Fix Released

Bug description:
  /home/dcb/qemu/trunk/qemu/hw/i386/intel_iommu.c:902:5: error: logical ‘and’ applied to non-boolean constant [-Werror=logical-op]
       pvtd_as = s->address_spaces[VTD_SID_TO_BUS(source_id)];
       ^

  $ fgrep VTD_SID_TO_BUS `find . -name \*.h -print`
  ./include/hw/i386/intel_iommu.h:#define VTD_SID_TO_BUS(sid)         (((sid) >> 8) && 0xff)
  $ 

  Sounds to me like

  #define VTD_SID_TO_BUS(sid)         (((sid) >> 8) & 0xff)

  would be better.

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1382477/+subscriptions