diff mbox

milkymist-pfpu: fix potential integer overflow

Message ID 1476438710-9226-1-git-send-email-michael@walle.cc (mailing list archive)
State New, archived
Headers show

Commit Message

Michael Walle Oct. 14, 2016, 9:51 a.m. UTC
Since the lm32 is a 32 bit architecture, just return a 32 bit value which
is then converted to a 64 bit value.

Spotted by coverity, CID 1005506.

Signed-off-by: Michael Walle <michael@walle.cc>
---
 hw/misc/milkymist-pfpu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Michael Tokarev Oct. 15, 2016, 12:51 p.m. UTC | #1
14.10.2016 12:51, Michael Walle wrote:
> Since the lm32 is a 32 bit architecture, just return a 32 bit value which
> is then converted to a 64 bit value.
>
> Spotted by coverity, CID 1005506.

Applied to -trivial, thank you!

/mjt
diff mbox

Patch

diff --git a/hw/misc/milkymist-pfpu.c b/hw/misc/milkymist-pfpu.c
index 1da21a6..3ca2589 100644
--- a/hw/misc/milkymist-pfpu.c
+++ b/hw/misc/milkymist-pfpu.c
@@ -137,7 +137,7 @@  struct MilkymistPFPUState {
 };
 typedef struct MilkymistPFPUState MilkymistPFPUState;
 
-static inline hwaddr
+static inline uint32_t
 get_dma_address(uint32_t base, uint32_t x, uint32_t y)
 {
     return base + 8 * (128 * y + x);