https://git.reactos.org/?p=reactos.git;a=commitdiff;h=38791299ca9727d4b639b2...
commit 38791299ca9727d4b639b25bcf5aeca5716d1826 Author: Pierre Schweitzer pierre@reactos.org AuthorDate: Sat Apr 14 12:05:32 2018 +0200 Commit: Pierre Schweitzer pierre@reactos.org CommitDate: Sat Apr 14 12:05:32 2018 +0200
[VFATLIB] Simplify in-memory boot sector copy. So that, coverity is happy again. NFC
CID 1434230, 1434233, 1434238, 1434243, 1434246, 1434272 --- sdk/lib/fslib/vfatlib/fat12.c | 3 +-- sdk/lib/fslib/vfatlib/fat16.c | 3 +-- sdk/lib/fslib/vfatlib/fat32.c | 3 +-- 3 files changed, 3 insertions(+), 6 deletions(-)
diff --git a/sdk/lib/fslib/vfatlib/fat12.c b/sdk/lib/fslib/vfatlib/fat12.c index bf96f8d2ec..1668fc4670 100644 --- a/sdk/lib/fslib/vfatlib/fat12.c +++ b/sdk/lib/fslib/vfatlib/fat12.c @@ -38,8 +38,7 @@ Fat12WriteBootSector(IN HANDLE FileHandle, RtlZeroMemory(NewBootSector, BootSector->BytesPerSector);
/* Copy FAT16 BPB to new bootsector */ - memcpy(&NewBootSector->Jump[0], - &BootSector->Jump[0], + memcpy(NewBootSector, BootSector, FIELD_OFFSET(FAT16_BOOT_SECTOR, Res2) - FIELD_OFFSET(FAT16_BOOT_SECTOR, Jump)); /* FAT16 BPB length (up to (not including) Res2) */
diff --git a/sdk/lib/fslib/vfatlib/fat16.c b/sdk/lib/fslib/vfatlib/fat16.c index 1438532390..ac38311547 100644 --- a/sdk/lib/fslib/vfatlib/fat16.c +++ b/sdk/lib/fslib/vfatlib/fat16.c @@ -38,8 +38,7 @@ Fat16WriteBootSector(IN HANDLE FileHandle, RtlZeroMemory(NewBootSector, BootSector->BytesPerSector);
/* Copy FAT16 BPB to new bootsector */ - memcpy(&NewBootSector->Jump[0], - &BootSector->Jump[0], + memcpy(NewBootSector, BootSector, FIELD_OFFSET(FAT16_BOOT_SECTOR, Res2) - FIELD_OFFSET(FAT16_BOOT_SECTOR, Jump)); /* FAT16 BPB length (up to (not including) Res2) */
diff --git a/sdk/lib/fslib/vfatlib/fat32.c b/sdk/lib/fslib/vfatlib/fat32.c index 1987af4fdd..4e789372d4 100644 --- a/sdk/lib/fslib/vfatlib/fat32.c +++ b/sdk/lib/fslib/vfatlib/fat32.c @@ -38,8 +38,7 @@ Fat32WriteBootSector(IN HANDLE FileHandle, RtlZeroMemory(NewBootSector, BootSector->BytesPerSector);
/* Copy FAT32 BPB to new bootsector */ - memcpy(&NewBootSector->Jump[0], - &BootSector->Jump[0], + memcpy(NewBootSector, BootSector, FIELD_OFFSET(FAT32_BOOT_SECTOR, Res2) - FIELD_OFFSET(FAT32_BOOT_SECTOR, Jump)); /* FAT32 BPB length (up to (not including) Res2) */