Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
unmap: fix the potential negative length
We should not handle the unmap length less than the sector size to prevent the negative length. e.g. if the sector size is 4096 bytes, we try to unmap the 512 byte start from offset 1. The `startSectorOffset` would be 1. The `endSectorOffset` would be 513. Then the `length` would be a negative number. The minimal unmap unit is the sector size, so we could return if the length is less than the sector size. That also can avoid the above situation. Signed-off-by: Vicente Cheng <vicente.cheng@suse.com> Co-authored-by: Derek Su <derek.su@suse.com>
- Loading branch information