Fix an overflow in blkcnt_t gpt_last_lba
If CONFIG_FS_LARGEFILE is not defined, the calculation overflows for larger disks, since blkcnt_t is 32 bits. Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
This commit is contained in:
parent
a6147109b1
commit
ae31cbde09
@ -173,8 +173,8 @@ static const struct gpt_guid_s g_null_guid;
|
||||
|
||||
static inline blkcnt_t gpt_last_lba(FAR struct partition_state_s *state)
|
||||
{
|
||||
return (state->nblocks * state->blocksize + GPT_BLOCK_SIZE - 1) /
|
||||
GPT_BLOCK_SIZE - 1;
|
||||
return (((uint64_t)state->nblocks) * state->blocksize + GPT_BLOCK_SIZE - 1)
|
||||
/ GPT_BLOCK_SIZE - 1;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
|
Loading…
Reference in New Issue
Block a user