mirror of
https://github.com/apache/nuttx.git
synced 2026-05-20 04:16:35 +08:00
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:
committed by
Alin Jerpelea
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;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
|
||||
Reference in New Issue
Block a user