[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 11/23] hw/intc/apic.c: Use uint32_t for mask word in
From: |
Michael Tokarev |
Subject: |
[Qemu-devel] [PULL 11/23] hw/intc/apic.c: Use uint32_t for mask word in foreach_apic |
Date: |
Thu, 27 Mar 2014 19:28:16 +0400 |
From: Peter Maydell <address@hidden>
Use unsigned arithmetic for operations on the mask word
in the foreach_apic() macro, to avoid relying on undefined
behaviour when shifting into the sign bit.
Signed-off-by: Peter Maydell <address@hidden>
Reviewed-by: Stefan Weil <address@hidden>
Reviewed-by: Michael S. Tsirkin <address@hidden>
Signed-off-by: Michael Tokarev <address@hidden>
---
hw/intc/apic.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/hw/intc/apic.c b/hw/intc/apic.c
index 361ae90..b8c061b 100644
--- a/hw/intc/apic.c
+++ b/hw/intc/apic.c
@@ -201,12 +201,12 @@ static void apic_external_nmi(APICCommonState *s)
#define foreach_apic(apic, deliver_bitmask, code) \
{\
- int __i, __j, __mask;\
+ int __i, __j;\
for(__i = 0; __i < MAX_APIC_WORDS; __i++) {\
- __mask = deliver_bitmask[__i];\
+ uint32_t __mask = deliver_bitmask[__i];\
if (__mask) {\
for(__j = 0; __j < 32; __j++) {\
- if (__mask & (1 << __j)) {\
+ if (__mask & (1U << __j)) {\
apic = local_apics[__i * 32 + __j];\
if (apic) {\
code;\
--
1.7.10.4
- [Qemu-devel] [PULL 01/23] target-s390x: Add missing 'static' and 'const' attributes, (continued)
- [Qemu-devel] [PULL 01/23] target-s390x: Add missing 'static' and 'const' attributes, Michael Tokarev, 2014/03/27
- [Qemu-devel] [PULL 17/23] hw/ppc: Avoid shifting left into sign bit, Michael Tokarev, 2014/03/27
- [Qemu-devel] [PULL 16/23] hw/intc/openpic: Avoid shifting left into sign bit, Michael Tokarev, 2014/03/27
- [Qemu-devel] [PULL 15/23] hw/usb/hcd-ohci.c: Avoid shifting left into sign bit, Michael Tokarev, 2014/03/27
- [Qemu-devel] [PULL 09/23] CODING_STYLE: Section about mixed declarations, Michael Tokarev, 2014/03/27
- [Qemu-devel] [PULL 18/23] tests/libqos/pci-pc: Avoid shifting left into sign bit, Michael Tokarev, 2014/03/27
- [Qemu-devel] [PULL 02/23] target-arm: Add missing 'static' attribute, Michael Tokarev, 2014/03/27
- [Qemu-devel] [PULL 08/23] doc: update default PowerPC framebuffer settings, Michael Tokarev, 2014/03/27
- [Qemu-devel] [PULL 04/23] util: Add 'static' attribute to function implementation, Michael Tokarev, 2014/03/27
- [Qemu-devel] [PULL 19/23] hw/intc/slavio_intctl: Avoid shifting left into sign bit, Michael Tokarev, 2014/03/27
- [Qemu-devel] [PULL 11/23] hw/intc/apic.c: Use uint32_t for mask word in foreach_apic,
Michael Tokarev <=
- [Qemu-devel] [PULL 03/23] hw/ide: Add missing 'static' attributes, Michael Tokarev, 2014/03/27
- Re: [Qemu-devel] [PULL for-2.0 00/23] Trivial patches for 2014-03-27, Peter Maydell, 2014/03/27