mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
MDEV-33161 Function pointer signature mismatch in LF_HASH
In cmake -DWITH_UBSAN=ON builds with clang but not with GCC, -fsanitize=undefined will flag several runtime errors on function pointer mismatch related to the lock-free hash table LF_HASH. Let us use matching function signatures and remove function pointer casts in order to avoid potential bugs due to undefined behaviour. These errors could be caught at compilation time by -Wcast-function-type-strict, which is available starting with clang-16, but not available in any version of GCC as of now. The old GCC flag -Wcast-function-type is enabled as part of -Wextra, but it specifically does not catch these errors. Reviewed by: Vladislav Vaintroub
This commit is contained in:
@ -133,9 +133,10 @@ struct close_cached_connection_tables_arg
|
||||
};
|
||||
|
||||
|
||||
static my_bool close_cached_connection_tables_callback(
|
||||
TDC_element *element, close_cached_connection_tables_arg *arg)
|
||||
static my_bool close_cached_connection_tables_callback(void *el, void *a)
|
||||
{
|
||||
TDC_element *element= static_cast<TDC_element*>(el);
|
||||
auto arg= static_cast<close_cached_connection_tables_arg*>(a);
|
||||
TABLE_LIST *tmp;
|
||||
|
||||
mysql_mutex_lock(&element->LOCK_table_share);
|
||||
@ -188,9 +189,7 @@ static bool close_cached_connection_tables(THD *thd, LEX_CSTRING *connection)
|
||||
close_cached_connection_tables_arg argument= { thd, connection, 0 };
|
||||
DBUG_ENTER("close_cached_connections");
|
||||
|
||||
if (tdc_iterate(thd,
|
||||
(my_hash_walk_action) close_cached_connection_tables_callback,
|
||||
&argument))
|
||||
if (tdc_iterate(thd, close_cached_connection_tables_callback, &argument))
|
||||
DBUG_RETURN(true);
|
||||
|
||||
DBUG_RETURN(argument.tables ?
|
||||
|
Reference in New Issue
Block a user