mirror of
https://github.com/amadvance/snapraid.git
synced 2026-10-26 19:01:57 -04:00
Fix potential uint64_t overflow in parity tail ceil division in locate
This commit is contained in:
parent
31661e13bd
commit
0410fbc399
1 changed files with 2 additions and 2 deletions
|
|
@ -104,14 +104,14 @@ static void collect_parity_block_file(uint32_t block_size, struct snapraid_disk*
|
|||
tommy_list_insert_tail(file_list, &entry->node, entry);
|
||||
}
|
||||
|
||||
void state_locate_info(struct snapraid_state* state, uint64_t parity_tail, struct snapraid_locate_info* info)
|
||||
static void state_locate_info(struct snapraid_state* state, uint64_t parity_tail, struct snapraid_locate_info* info)
|
||||
{
|
||||
uint32_t block_size = state->block_size;
|
||||
|
||||
info->block_max = parity_allocated_size(state);
|
||||
info->parity_size = info->block_max * (uint64_t)block_size;
|
||||
|
||||
info->tail_block = (parity_tail + block_size - 1) / block_size;
|
||||
info->tail_block = (parity_tail / block_size) + (parity_tail % block_size != 0);
|
||||
|
||||
if (info->tail_block > info->block_max)
|
||||
info->low_to_free_tail_block = 0;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue