Skip to content

Commit c8ab060

Browse files
authored
Fix: Packed attribute missing for FF_Part_t causing buggy memcpy and alignment issues (#77)
Fix: Packed attribute missing for FF_Part_t causing buggy memcpy and alignment issues Description ----------- The structure `FF_Part_t` was used with `memcpy` to copy partition data (`pxPartitions + xPartNr` into `p`) in ff_ioman.c, but it contains bitfields: typedef struct _SPart { uint32_t ulStartLBA; uint32_t ulSectorCount; uint32_t ucActive : 8, ucPartitionID : 8, bIsExtended : 1; } FF_Part_t; Test Steps ----------- This is a general fix; no additional tests are required. Checklist: ---------- - [ ] I have tested my changes. No regression in existing tests[NOT TESTED]. - [ ] I have modified and/or added unit-tests to cover the code changes in this Pull Request. Related Issue ----------- None opened By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.
1 parent 0a38fb8 commit c8ab060

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

include/ff_ioman.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -375,10 +375,10 @@
375375
{
376376
uint32_t ulStartLBA; /* FF_FAT_PTBL_LBA */
377377
uint32_t ulSectorCount; /* FF_FAT_PTBL_SECT_COUNT */
378-
uint32_t
379-
ucActive : 8, /* FF_FAT_PTBL_ACTIVE */
380-
ucPartitionID : 8, /* FF_FAT_PTBL_ID */
381-
bIsExtended : 1;
378+
uint8_t ucActive; /* FF_FAT_PTBL_ACTIVE */
379+
uint8_t ucPartitionID; /* FF_FAT_PTBL_ID */
380+
uint8_t bIsExtended;
381+
uint8_t bIsUnused; /*Byte added to make the length a multiple of 32 byte.*/
382382
} FF_Part_t;
383383

384384
typedef struct _SPartFound

0 commit comments

Comments
 (0)