Bug #64312 valgrind reports chk_dev uninitialized variable, presumably old_link
Submitted: 13 Feb 2012 23:36 Modified: 27 Feb 2012 20:35
Reporter: Egbert S Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Storage Engine API Severity:S3 (Non-critical)
Version:5.1.52 OS:Linux (CentOS 6.0)
Assigned to: CPU Architecture:Any
Tags: chk_dev

[13 Feb 2012 23:36] Egbert S
Description:
# valgrind --track-origins=yes --trace-children=yes /usr/libexec/mysqld --basedir=/usr --datadir=/var/lib/mysql --user=mysql --log-error=/var/log/mysqld.log --open-files-limit=2048 --pid-file=/var/run/mysqld/mysqld.pid --socket=/var/lib/mysql/mysql.sock --port=3306

==10645== Memcheck, a memory error detector
==10645== Copyright (C) 2002-2010, and GNU GPL'd, by Julian Seward et al.
==10645== Using Valgrind-3.6.0 and LibVEX; rerun with -h for copyright info
==10645== Command: /usr/libexec/mysqld --basedir=/usr --datadir=/var/lib/mysql --user=mysql --log-error=/var/log/mysqld.log --open-files-limit=2048 --pid-file=/var/run/mysqld/mysqld.pid --socket=/var/lib/mysql/mysql.sock --port=3306
==10645== 
==10645== Conditional jump or move depends on uninitialised value(s)
==10645==    at 0x81CE2D: chk_del (in /usr/libexec/mysqld)
==10645==    by 0x7F9DAD: ha_myisam::check(THD*, st_ha_check_opt*) (in /usr/libexec/mysqld)
==10645==    by 0x7F9749: ha_myisam::check_and_repair(THD*) (in /usr/libexec/mysqld)
==10645==    by 0x6013C5: ??? (in /usr/libexec/mysqld)
==10645==    by 0x605078: open_table(THD*, TABLE_LIST*, st_mem_root*, bool*, unsigned int) (in /usr/libexec/mysqld)
==10645==    by 0x605C2F: open_tables(THD*, TABLE_LIST**, unsigned int*, unsigned int) (in /usr/libexec/mysqld)
==10645==    by 0x605E39: open_and_lock_tables_derived(THD*, TABLE_LIST*, bool) (in /usr/libexec/mysqld)
==10645==    by 0x65F761: acl_reload(THD*) (in /usr/libexec/mysqld)
==10645==    by 0x660AA2: acl_init(bool) (in /usr/libexec/mysqld)
==10645==    by 0x5BE02E: main (in /usr/libexec/mysqld)
==10645==  Uninitialised value was created by a stack allocation
==10645==    at 0x81CCA7: chk_del (in /usr/libexec/mysqld)

How to repeat:
# valgrind --track-origins=yes --trace-children=yes /usr/libexec/mysqld --basedir=/usr --datadir=/var/lib/mysql --user=mysql --log-error=/var/log/mysqld.log --open-files-limit=2048 --pid-file=/var/run/mysqld/mysqld.pid --socket=/var/lib/mysql/mysql.sock --port=3306

Suggested fix:
Not sure why there is an UNINIT_VAR() macro wrapping the old_link, but valgrind complains.
{{{
int chk_del(MI_CHECK *param, register MI_INFO *info, uint test_flag)
{
  reg2 ha_rows i;
  uint delete_link_length;
  my_off_t empty,next_link,UNINIT_VAR(old_link);
}}}
[14 Feb 2012 17:06] Sveta Smirnova
Thank you for the report.

Looks like bug #61985. Please send us query you issue before getting this error.
[27 Feb 2012 20:35] Egbert S
It is exactly #61985.   I'm closing this bug.
[27 Feb 2012 20:35] Egbert S
It is exactly #61985.   I'm closing this bug.