From: Julian Seward Date: Thu, 29 May 2008 13:45:49 +0000 (+0000) Subject: Make the size calculations inside VG_(mallinfo) 64-bit clean. X-Git-Tag: svn/VALGRIND_3_4_0~539 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=72a3a2f4f2a5858f1fbfe0651cfb808c86bfb20f;p=thirdparty%2Fvalgrind.git Make the size calculations inside VG_(mallinfo) 64-bit clean. I don't really understand how 'struct mallinfo' makes any sense on a 64-bit platform given that all the field sizes are 32-bit ints, and surely at least .arena and .uordblocks and probably others could easily exceed 32-bit range. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@8149 --- diff --git a/coregrind/m_mallocfree.c b/coregrind/m_mallocfree.c index f78b18eac7..3ac2a62495 100644 --- a/coregrind/m_mallocfree.c +++ b/coregrind/m_mallocfree.c @@ -1502,7 +1502,7 @@ SizeT VG_(arena_payload_szB) ( ThreadId tid, ArenaId aid, void* ptr ) // client request. So instead we use a pointer to do call by reference. void VG_(mallinfo) ( ThreadId tid, struct vg_mallinfo* mi ) { - UInt i, free_blocks, free_blocks_size; + UWord i, free_blocks, free_blocks_size; Arena* a = arenaId_to_ArenaP(VG_AR_CLIENT); // Traverse free list and calculate free blocks statistics. @@ -1513,7 +1513,7 @@ void VG_(mallinfo) ( ThreadId tid, struct vg_mallinfo* mi ) if (b == NULL) continue; for (;;) { free_blocks++; - free_blocks_size += get_pszB(a, b); + free_blocks_size += (UWord)get_pszB(a, b); b = get_next_b(b); if (b == a->freelist[i]) break; }