fs/partition: MBR parser should initialize blocksize field

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
Xiang Xiao 2023-05-19 06:16:35 +08:00 committed by Alan Carvalho de Assis
parent 547e0a051f
commit 5528c84c03
2 changed files with 3 additions and 2 deletions

View File

@ -40,7 +40,7 @@
#define GPT_BLOCK_SIZE 512
#define GPT_HEADER_SIGNATURE 0x5452415020494645ull
#define GPT_PARTNAME_MAX_SIZE (72 / sizeof(uint16_t))
#define GPT_LBA_TO_BLOCK(lba, blk) ((le64toh(lba) * 512 + (blk) -1) / (blk))
#define GPT_LBA_TO_BLOCK(lba, blk) ((le64toh(lba) * 512 + (blk) - 1) / (blk))
/****************************************************************************
* Private Types
@ -204,7 +204,7 @@ gpt_alloc_verify_entries(FAR struct partition_state_s *state,
return NULL;
}
blk = (size + (state->blocksize -1)) / state->blocksize;
blk = (size + (state->blocksize - 1)) / state->blocksize;
pte = kmm_zalloc(blk * state->blocksize);
if (!pte)
{

View File

@ -136,6 +136,7 @@ int parse_mbr_partition(FAR struct partition_state_s *state,
state->blocksize);
pentry.nblocks = MBR_LBA_TO_BLOCK(table[i].partition_size,
state->blocksize);
pentry.blocksize = state->blocksize;
if (pentry.nblocks != 0)
{