From 2efc8ff757dea3dbd433d2afb81f9b9d72a90f26 Mon Sep 17 00:00:00 2001 From: "Daniel P. Berrange" Date: Sat, 17 Nov 2007 11:53:44 +0000 Subject: [PATCH] Fixed 32-bit overflow --- ChangeLog | 4 ++++ src/stats_linux.c | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index a23c3cd8ac..6efe3b13e7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +Sat Nov 17 11:55:33 UTC 2007 Daniel P. Berrange + + * src/stats_linux.c: Fixed overflow of left shift on 32-bit platforms + Sat Nov 17 11:04:33 UTC 2007 Daniel P. Berrange * qemud/Makefile.am: Remove protocol.[chx] from EXTRA_DIST. diff --git a/src/stats_linux.c b/src/stats_linux.c index f35d5dd4e1..9c7ed72e2e 100644 --- a/src/stats_linux.c +++ b/src/stats_linux.c @@ -200,7 +200,7 @@ read_bd_stats (virConnectPtr conn, xenUnifiedPrivatePtr priv, * an assumed sector size. */ if (stats->rd_bytes > 0) { - if (stats->rd_bytes >= 1L<<(63-9)) { + if (stats->rd_bytes >= ((unsigned long long)1)<<(63-9)) { statsErrorFunc (conn, VIR_ERR_NO_SUPPORT, __FUNCTION__, "stats->rd_bytes would overflow 64 bit counter", domid); @@ -209,7 +209,7 @@ read_bd_stats (virConnectPtr conn, xenUnifiedPrivatePtr priv, stats->rd_bytes *= 512; } if (stats->wr_bytes > 0) { - if (stats->wr_bytes >= 1L<<(63-9)) { + if (stats->wr_bytes >= ((unsigned long long)1)<<(63-9)) { statsErrorFunc (conn, VIR_ERR_NO_SUPPORT, __FUNCTION__, "stats->wr_bytes would overflow 64 bit counter", domid);