Skip to content

Incompatibility when using large capacity disks (4T SSD) #12

Open

Description

@lisc5324

I use the GPT partition tool to partition the disk and format the file system with exFAT. Use Filex (no system mode) on the zynq xc7z045(ARM Cortex-A9 32bit) development board. An error is always reported. Such as a function _fx_utility_logical_sector_read:

图片

Has anyone patched it.

Activity

  1. transferred this issue fromon Jan 9, 2024
  2. nflandin commented on Aug 30, 2024

    @nflandin
    Contributor

    This does appear to be a bug due to an overflow, as ULONG max is 4294967295, which would correspond to 21990023255040 bytes if there was a 512-byte sector size. I am not sure why fx_media_total_sectors (a ULONG64) is cast to ULONG, as there is no comment explaining it; perhaps this was done to speed up the comparison. I suspect this was a simple mistake, as fx_media_total_sectors is cast to ULONG64 in a number of other places, and is not cast at all when the exact same comparison is made in fx_utility_sector_write (lines 318 & 388).

    The simplest solution (and the one I believe to be best) for this would be to simply eliminate the cast. Another solution (to allow for large drives without unnecessarily compromising performance for smaller media) would be to allow a ULONG64 comparison when exFAT is enabled:

    `#ifdef FX_ENABLE_EXFAT

        if ((logical_sector + sectors - 1) > media_ptr -> fx_media_total_sectors)
    

    #else

        if ((logical_sector + sectors - 1) > (ULONG)media_ptr -> fx_media_total_sectors)
    

    #endif`

    A workaround would be to increase sector size, and the exFAT max of 4096 bytes/sector would result in a 17592186040320 byte limit. The issue with this is that it limits you to what are basically FAT32 partitions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions