summaryrefslogtreecommitdiff
path: root/storage
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@oracle.com>2011-02-15 10:51:33 +0200
committerMarko Mäkelä <marko.makela@oracle.com>2011-02-15 10:51:33 +0200
commit0efaef7d469eb6decdd8cf17057154914a10fd41 (patch)
tree95dedd85ae598b018b6385495a22ef064745e550 /storage
parent4a8c83574626f4107ca84964f4c1faa13176eff1 (diff)
downloadmariadb-git-0efaef7d469eb6decdd8cf17057154914a10fd41.tar.gz
Bug#59307 Valgrind: uninitialized value in rw_lock_set_writer_id_and_recursion_flag()
rw_lock_create_func(): Initialize lock->writer_thread, so that Valgrind will not complain even when Valgrind instrumentation is not enabled. Flag lock->writer_thread uninitialized, so that Valgrind can complain when it is used uninitialized. rw_lock_set_writer_id_and_recursion_flag(): Revert the bogus Valgrind instrumentation that was pushed in the first attempt to fix this bug.
Diffstat (limited to 'storage')
-rw-r--r--storage/innodb_plugin/ChangeLog6
-rw-r--r--storage/innodb_plugin/include/sync0rw.ic1
-rw-r--r--storage/innodb_plugin/sync/sync0rw.c3
3 files changed, 9 insertions, 1 deletions
diff --git a/storage/innodb_plugin/ChangeLog b/storage/innodb_plugin/ChangeLog
index 9fa00ac8e6f..1b2747ab012 100644
--- a/storage/innodb_plugin/ChangeLog
+++ b/storage/innodb_plugin/ChangeLog
@@ -1,3 +1,9 @@
+2011-02-15 The InnoDB Team
+
+ * sync/sync0rw.c, innodb_bug59307.test:
+ Bug#59307 Valgrind: uninitialized value in
+ rw_lock_set_writer_id_and_recursion_flag()
+
2011-02-14 The InnoDB Team
* handler/handler0alter.cc:
diff --git a/storage/innodb_plugin/include/sync0rw.ic b/storage/innodb_plugin/include/sync0rw.ic
index 4110a0a7e0c..7116f1b7c9b 100644
--- a/storage/innodb_plugin/include/sync0rw.ic
+++ b/storage/innodb_plugin/include/sync0rw.ic
@@ -280,7 +280,6 @@ rw_lock_set_writer_id_and_recursion_flag(
local_thread = lock->writer_thread;
success = os_compare_and_swap_thread_id(
&lock->writer_thread, local_thread, curr_thread);
- UNIV_MEM_VALID(&success, sizeof(success));
ut_a(success);
lock->recursive = recursive;
diff --git a/storage/innodb_plugin/sync/sync0rw.c b/storage/innodb_plugin/sync/sync0rw.c
index 00e0324becd..a5da606ad80 100644
--- a/storage/innodb_plugin/sync/sync0rw.c
+++ b/storage/innodb_plugin/sync/sync0rw.c
@@ -260,6 +260,9 @@ rw_lock_create_func(
contains garbage at initialization and cannot be used for
recursive x-locking. */
lock->recursive = FALSE;
+ /* Silence Valgrind when UNIV_DEBUG_VALGRIND is not enabled. */
+ memset((void*) &lock->writer_thread, 0, sizeof lock->writer_thread);
+ UNIV_MEM_INVALID(&lock->writer_thread, sizeof lock->writer_thread);
#ifdef UNIV_SYNC_DEBUG
UT_LIST_INIT(lock->debug_list);