Fixed 32-bit overflow

This commit is contained in:
Daniel P. Berrange 2007-11-17 11:53:44 +00:00
parent 6bb2d376b5
commit 2efc8ff757
2 changed files with 6 additions and 2 deletions

View File

@ -1,3 +1,7 @@
Sat Nov 17 11:55:33 UTC 2007 Daniel P. Berrange <berrange@redhat.com>
* src/stats_linux.c: Fixed overflow of left shift on 32-bit platforms
Sat Nov 17 11:04:33 UTC 2007 Daniel P. Berrange <berrange@redhat.com>
* qemud/Makefile.am: Remove protocol.[chx] from EXTRA_DIST.

View File

@ -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);