* [Qemu-devel] [PATCH] pci/shpc: fix signed integer overflow
@ 2015-03-09 15:04 Michael S. Tsirkin
0 siblings, 0 replies; only message in thread
From: Michael S. Tsirkin @ 2015-03-09 15:04 UTC (permalink / raw)
To: qemu-devel; +Cc: Peter Maydell
clang undefined behaviour sanitizer reports:
> hw/pci/shpc.c:162:27: runtime error: left shift of 1 by 31 places
> cannot be represented in type 'int'
Caused by the usual lack of a 'U' qualifier on a constant 1 being
shifted left. Fix it up.
Reported-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
hw/pci/shpc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/hw/pci/shpc.c b/hw/pci/shpc.c
index 5fd7f4b..759910f 100644
--- a/hw/pci/shpc.c
+++ b/hw/pci/shpc.c
@@ -159,7 +159,7 @@ static void shpc_interrupt_update(PCIDevice *d)
for (slot = 0; slot < shpc->nslots; ++slot) {
uint8_t event = shpc->config[SHPC_SLOT_EVENT_LATCH(slot)];
uint8_t disable = shpc->config[SHPC_SLOT_EVENT_SERR_INT_DIS(d, slot)];
- uint32_t mask = 1 << SHPC_IDX_TO_LOGICAL(slot);
+ uint32_t mask = 1U << SHPC_IDX_TO_LOGICAL(slot);
if (event & ~disable) {
int_locator |= mask;
}
--
MST
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2015-03-09 15:04 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-03-09 15:04 [Qemu-devel] [PATCH] pci/shpc: fix signed integer overflow Michael S. Tsirkin
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).