diff --git a/sql/ha_partition.cc b/sql/ha_partition.cc index 8606c28d046..8ab9c346ca6 100644 --- a/sql/ha_partition.cc +++ b/sql/ha_partition.cc @@ -3282,10 +3282,12 @@ handlerton *ha_partition::get_def_part_engine(const char *name) goto err; if (state.st_size <= 64) goto err; - if (!(frm_image= (uchar*)my_malloc(key_memory_Partition_share, - state.st_size, MYF(MY_WME)))) + if ((ulonglong)state.st_size >= SIZE_T_MAX) /* Whole file need to fit into memory*/ goto err; - if (mysql_file_read(file, frm_image, state.st_size, MYF(MY_NABP))) + if (!(frm_image= (uchar*)my_malloc(key_memory_Partition_share, + (size_t)state.st_size, MYF(MY_WME)))) + goto err; + if (mysql_file_read(file, frm_image, (size_t)state.st_size, MYF(MY_NABP))) goto err; if (frm_image[64] != '/') diff --git a/storage/innobase/buf/buf0flu.cc b/storage/innobase/buf/buf0flu.cc index d74ccd75521..a554309915d 100644 --- a/storage/innobase/buf/buf0flu.cc +++ b/storage/innobase/buf/buf0flu.cc @@ -2168,7 +2168,7 @@ func_exit: sum_pages += last_pages_in; - const ulint time_elapsed = std::max(curr_time - prev_time, 1); + const ulint time_elapsed = std::max(ulint(curr_time - prev_time), 1); /* We update our variables every innodb_flushing_avg_loops iterations to smooth out transition in workload. */