From 4ecd80297e769f96b0150e4830740119f696b0f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= <marko.makela@oracle.com> Date: Tue, 25 May 2010 15:37:48 +0300 Subject: [PATCH] Suppress bogus Valgrind warnings about buf_buddy_relocate() accessing uninitialized memory in Valgrind-instrumented builds. --- mysql-test/valgrind.supp | 5 +++++ storage/innodb_plugin/buf/buf0buddy.c | 14 +++++++++----- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/mysql-test/valgrind.supp b/mysql-test/valgrind.supp index 6b10e4cb54..d082b750de 100644 --- a/mysql-test/valgrind.supp +++ b/mysql-test/valgrind.supp @@ -722,3 +722,8 @@ fun:pthread_create* } +{ + buf_buddy_relocate peeking (space,page) in potentially free blocks + Memcheck:Addr1 + fun:buf_buddy_relocate +} diff --git a/storage/innodb_plugin/buf/buf0buddy.c b/storage/innodb_plugin/buf/buf0buddy.c index 07753cb8a6..ee5a569c3f 100644 --- a/storage/innodb_plugin/buf/buf0buddy.c +++ b/storage/innodb_plugin/buf/buf0buddy.c @@ -442,11 +442,15 @@ buf_buddy_relocate( pool), so there is nothing wrong about this. The mach_read_from_4() calls here will only trigger bogus Valgrind memcheck warnings in UNIV_DEBUG_VALGRIND builds. */ - bpage = buf_page_hash_get( - mach_read_from_4((const byte*) src - + FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID), - mach_read_from_4((const byte*) src - + FIL_PAGE_OFFSET)); + ulint space = mach_read_from_4( + (const byte*) src + FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID); + ulint page_no = mach_read_from_4( + (const byte*) src + FIL_PAGE_OFFSET); + /* Suppress Valgrind warnings about conditional jump + on uninitialized value. */ + UNIV_MEM_VALID(&space, sizeof space); + UNIV_MEM_VALID(&page_no, sizeof page_no); + bpage = buf_page_hash_get(space, page_no); if (!bpage || bpage->zip.data != src) { /* The block has probably been freshly -- 2.30.9