Skip to content

Commit

Permalink
MDEV-15053 fixup: MSAN use-of-uninitialized-value
Browse files Browse the repository at this point in the history
buf_page_init_for_read(): Initialize the output parameter of
buf_buddy_alloc().
  • Loading branch information
dr-m committed Jun 6, 2020
1 parent 6877ef9 commit 095d656
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 11 deletions.
6 changes: 3 additions & 3 deletions storage/innobase/buf/buf0buddy.cc
Original file line number Diff line number Diff line change
Expand Up @@ -431,9 +431,9 @@ buf_buddy_alloc_from(void* buf, ulint i, ulint j)
return(buf);
}

/** Allocate a block.
@param[in] i index of buf_pool.zip_free[] or BUF_BUDDY_SIZES
@param[out] lru whether buf_pool.mutex was temporarily released
/** Allocate a ROW_FORMAT=COMPRESSED block.
@param i index of buf_pool.zip_free[] or BUF_BUDDY_SIZES
@param lru assigned to true if buf_pool.mutex was temporarily released
@return allocated block, never NULL */
byte *buf_buddy_alloc_low(ulint i, bool *lru)
{
Expand Down
5 changes: 2 additions & 3 deletions storage/innobase/buf/buf0rea.cc
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ static buf_page_t* buf_page_init_for_read(ulint mode, const page_id_t page_id,
ulint zip_size, bool unzip)
{
mtr_t mtr;
bool lru= false;

if (mode == BUF_READ_IBUF_PAGES_ONLY)
{
Expand Down Expand Up @@ -169,7 +168,7 @@ static buf_page_t* buf_page_init_for_read(ulint mode, const page_id_t page_id,
block descriptor has been added to buf_pool.LRU and
buf_pool.page_hash. */
block->page.zip.data= static_cast<page_zip_t*>
(buf_buddy_alloc(zip_size, &lru));
(buf_buddy_alloc(zip_size));

/* To maintain the invariant
block->in_unzip_LRU_list == block->page.belongs_to_unzip_LRU()
Expand All @@ -187,7 +186,7 @@ static buf_page_t* buf_page_init_for_read(ulint mode, const page_id_t page_id,
control block (bpage), in order to avoid the
invocation of buf_buddy_relocate_block() on
uninitialized data. */
bool lru;
bool lru= false;
void *data= buf_buddy_alloc(zip_size, &lru);

rw_lock_x_lock(hash_lock);
Expand Down
9 changes: 4 additions & 5 deletions storage/innobase/include/buf0buddy.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,14 @@ buf_buddy_get_slot(ulint size)
}

/** Allocate a ROW_FORMAT=COMPRESSED block.
@param[in] i index of buf_pool.zip_free[] or BUF_BUDDY_SIZES
@param[out] lru whether buf_pool.mutex was temporarily released
@param i index of buf_pool.zip_free[] or BUF_BUDDY_SIZES
@param lru assigned to true if buf_pool.mutex was temporarily released
@return allocated block, never NULL */
byte *buf_buddy_alloc_low(ulint i, bool *lru) MY_ATTRIBUTE((malloc));

/** Allocate a ROW_FORMAT=COMPRESSED block.
The caller must not hold buf_pool.mutex.
@param[in] size compressed page size
@param[out] lru whether buf_pool.mutex was temporarily released
@param size compressed page size in bytes
@param lru assigned to true if buf_pool.mutex was temporarily released
@return allocated block, never NULL */
inline byte *buf_buddy_alloc(ulint size, bool *lru= nullptr)
{
Expand Down

0 comments on commit 095d656

Please sign in to comment.