Skip to content
  • Kevin Wolf's avatar
    b9b8860d
    vvfat: Fix vvfat_write() for writes before the root directory · b9b8860d
    Kevin Wolf authored
    
    
    The calculation in sector2cluster() is done relative to the offset of
    the root directory. Any writes to blocks before the start of the root
    directory (in particular, writes to the FAT) result in negative values,
    which are not handled correctly in vvfat_write().
    
    This changes sector2cluster() to return a signed value, and makes sure
    that vvfat_write() doesn't try to find mappings for negative cluster
    number. It clarifies the code in vvfat_write() to make it more obvious
    that the cluster numbers can be negative.
    
    Signed-off-by: default avatarKevin Wolf <kwolf@redhat.com>
    Message-Id: <20211209152231.23756-1-kwolf@redhat.com>
    Signed-off-by: default avatarKevin Wolf <kwolf@redhat.com>
    b9b8860d
    vvfat: Fix vvfat_write() for writes before the root directory
    Kevin Wolf authored
    
    
    The calculation in sector2cluster() is done relative to the offset of
    the root directory. Any writes to blocks before the start of the root
    directory (in particular, writes to the FAT) result in negative values,
    which are not handled correctly in vvfat_write().
    
    This changes sector2cluster() to return a signed value, and makes sure
    that vvfat_write() doesn't try to find mappings for negative cluster
    number. It clarifies the code in vvfat_write() to make it more obvious
    that the cluster numbers can be negative.
    
    Signed-off-by: default avatarKevin Wolf <kwolf@redhat.com>
    Message-Id: <20211209152231.23756-1-kwolf@redhat.com>
    Signed-off-by: default avatarKevin Wolf <kwolf@redhat.com>
Loading