Ext4Pkg: Fix GdtCsum calculation for block group descriptor

Doesn't take into account the empty checksum field and passes the correct initial value of 0xFFFF into the CRC16-ANSI function

Signed-off-by: Savva Mitrofanov <savvamtr@gmail.com>
This commit is contained in:
Savva Mitrofanov 2023-06-28 20:36:46 +03:00 committed by Mikhail Krichanov
parent 71cbd3cb57
commit b84aa16df8
1 changed files with 1 additions and 5 deletions

View File

@ -169,14 +169,10 @@ Ext4CalculateBlockGroupDescChecksumGdtCsum (
) )
{ {
UINT16 Csum; UINT16 Csum;
UINT16 Dummy;
Dummy = 0; Csum = CalculateCrc16Ansi (Partition->SuperBlock.s_uuid, sizeof (Partition->SuperBlock.s_uuid), 0xFFFF);
Csum = CalculateCrc16Ansi (Partition->SuperBlock.s_uuid, 16, 0);
Csum = CalculateCrc16Ansi (&BlockGroupNum, sizeof (BlockGroupNum), Csum); Csum = CalculateCrc16Ansi (&BlockGroupNum, sizeof (BlockGroupNum), Csum);
Csum = CalculateCrc16Ansi (BlockGroupDesc, OFFSET_OF (EXT4_BLOCK_GROUP_DESC, bg_checksum), Csum); Csum = CalculateCrc16Ansi (BlockGroupDesc, OFFSET_OF (EXT4_BLOCK_GROUP_DESC, bg_checksum), Csum);
Csum = CalculateCrc16Ansi (&Dummy, sizeof (Dummy), Csum);
Csum = Csum =
CalculateCrc16Ansi ( CalculateCrc16Ansi (
&BlockGroupDesc->bg_block_bitmap_hi, &BlockGroupDesc->bg_block_bitmap_hi,