summaryrefslogtreecommitdiffstats
path: root/FatPkg/EnhancedFatDxe/FileSpace.c
Commit message (Collapse)AuthorAgeFilesLines
* Revert "FatPkg: Validate Reserved FAT Entries on Volume Open"Oliver Smith-Denny9 days1-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 58766a472932c485d41163b1746fb1d9e7984f07. In edk2 commit 58766a4, validation of the two reserved FAT entries was added. However, it also checked the return of FatGetFatEntry to MAX_UINT32, which is what FatGetFatEntry returns when it encounters an error, e.g. not being able to read the disk. However, MAX_UINT32 is also a valid value for the reserved FAT entries and under some conditions these will be returned in the success case. A FAT volume formatted with these valid values of the reserved FAT entries will fail to boot an OS because the opening of the volume will fail. However, the reason FatGetFatEntry returns MAX_UINT32 is that most other uses of the function are comparing it against the END_OF_CHAIN mark, which MAX_UINT32 will trip and those functions will fail out. Because this is a critical bug that can prevent OS booting and the bug the original commit was solving was accounting for a bad FAT filesystem formatting tool, this commit is reverted for now. Future work will clean up FatGetFatEntry so that it returns an EFI_STATUS, but that involves more work and this bug needs to be resolved in the meantime. Signed-off-by: Oliver Smith-Denny <osde@microsoft.com>
* FatPkg: Validate Reserved FAT Entries on Volume OpenOliver Smith-Denny2025-01-211-1/+0
| | | | | | | | | | | | | | | | There are two reserved FAT entries in the FAT filesystem that are expected to have valid contents in them. Today the FAT drivers do not validate these entries when reading from a device for the first time. This can cause infinite loops in the FAT driver when trying to read corrupted disks as reported in https://github.com/tianocore/edk2/issues/9679. This PR follows the recommended update requested in that bug to check the two reserved FAT entries and validate their contents against the spec defined values in both FatPei and EnhancedFatDxe when opening a device for the first time. Signed-off-by: Oliver Smith-Denny <osde@microsoft.com>
* FatPkg: Apply uncrustify changesMichael Kubacki2021-12-071-139/+142
| | | | | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3737 Apply uncrustify changes to .c/.h files in the FatPkg package Cc: Andrew Fish <afish@apple.com> Cc: Leif Lindholm <leif@nuviainc.com> Cc: Michael D Kinney <michael.d.kinney@intel.com> Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com> Reviewed-by: Ray Ni <ray.ni@intel.com>
* FatPkg: Change use of EFI_D_* to DEBUG_*Michael D Kinney2021-12-071-6/+6
| | | | | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3739 Update all use of EFI_D_* defines in DEBUG() macros to DEBUG_* defines. Cc: Andrew Fish <afish@apple.com> Cc: Leif Lindholm <leif@nuviainc.com> Cc: Michael Kubacki <michael.kubacki@microsoft.com> Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com> Reviewed-by: Ray Ni <ray.ni@intel.com>
* FatPkg/EnhancedFatDxe: Fix various typosAntoine Coeur2020-02-101-3/+3
| | | | | | | | | | | Fix various typos in FatPkg/EnhancedFatDxe comments. Cc: Ray Ni <ray.ni@intel.com> Signed-off-by: Antoine Coeur <coeur@gmx.fr> Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com> Acked-by: Liming Gao <liming.gao@intel.com> Signed-off-by: Philippe Mathieu-Daude <philmd@redhat.com> Message-Id: <20200207010831.9046-8-philmd@redhat.com>
* FatPkg: Fix spelling errorsSean Brogan2019-10-221-3/+3
| | | | | | | | https://bugzilla.tianocore.org/show_bug.cgi?id=2264 Cc: Ray Ni <ray.ni@intel.com> Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com> Reviewed-by: Ray Ni <ray.ni@intel.com>
* FatPkg: Replace BSD License with BSD+Patent LicenseMichael D Kinney2019-04-091-7/+1
| | | | | | | | | | | | | | | | | | | | https://bugzilla.tianocore.org/show_bug.cgi?id=1373 Replace BSD 2-Clause License with BSD+Patent License. This change is based on the following emails: https://lists.01.org/pipermail/edk2-devel/2019-February/036260.html https://lists.01.org/pipermail/edk2-devel/2018-October/030385.html RFCs with detailed process for the license change: V3: https://lists.01.org/pipermail/edk2-devel/2019-March/038116.html V2: https://lists.01.org/pipermail/edk2-devel/2019-March/037669.html V1: https://lists.01.org/pipermail/edk2-devel/2019-March/037500.html Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com> Reviewed-by: Ray Ni <ray.ni@intel.com>
* FatPkg: Correct the line ending to CRLFRuiyu Ni2018-10-241-5/+5
| | | | | Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
* FatPkg/EnhancedFatDxe Fix Double Cluster AllocationRobinson, Herbie2018-10-241-7/+21
| | | | | | | | | | | | | | This is a fix for a double cluster allocation when the disk is full. The double allocation happens because FatGrowEof calls FatAllocateCluster without immediately marking the each returned cluster as allocated. The fix is to move the FatSetFatEntry call inside the loop. I've also include some improvements to the sanity checks that I added while tracking this down. They are optional. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Herbie Robinson <Herbie.Robinson@stratus.com> Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
* FatPkg/EnhancedFatDxe: Make the comments align with EDKIIcoding styleDandan Bi2016-12-091-208/+126
| | | | | | | Cc: Ruiyu Ni <ruiyu.ni@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Dandan Bi <dandan.bi@intel.com> Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
* FatPkg/EnhancedFatDxe: Make the variable name follow ruleDandan Bi2016-12-091-30/+30
| | | | | | | Cc: Ruiyu Ni <ruiyu.ni@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Dandan Bi <dandan.bi@intel.com> Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
* Change Fat driver to support asynchronous File IO introduced in UEFI spec ↵Ruiyu Ni2016-04-061-3/+5
| | | | | | | | | | | | | | | 2.3.1.D. Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com> Reviewed-by: Feng Tian <feng.tian@intel.com> (based on FatPkg commit 063f6e8a9c263bafd52e1226399fc64d6d721dca) [jordan.l.justen@intel.com: Use script to relicense to 2-clause BSD] Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Jordan Justen <jordan.l.justen@intel.com> Acked-by: Mark Doran <mark.doran@intel.com> Acked-by: Laszlo Ersek <lersek@redhat.com>
* Update copyright notice formatHot Tian2016-04-061-2/+2
| | | | | | | | | | (based on FatPkg commit 171c4de5919a4638db8f6f472b365ffbbac6070b) [jordan.l.justen@intel.com: Use script to relicense to 2-clause BSD] Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Jordan Justen <jordan.l.justen@intel.com> Acked-by: Mark Doran <mark.doran@intel.com> Acked-by: Laszlo Ersek <lersek@redhat.com>
* Add EDK II Prime FatPkg New Feature: Support both Unicode Collation and ↵Qing Huang2016-04-061-0/+816
Unicode Collation 2 Protocols Support both Component Name and Component Name 2 Protocol. (based on FatPkg commit e51cd032db84a6fb1f44a0605f80d96f5fdf4bc6) [jordan.l.justen@intel.com: Use script to relicense to 2-clause BSD] Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Jordan Justen <jordan.l.justen@intel.com> Acked-by: Mark Doran <mark.doran@intel.com> Acked-by: Laszlo Ersek <lersek@redhat.com>