atad: fix zero-progress loop for 65536-sector LBA48 transfers - #913
Merged
Conversation
ata_device_sector_io64 truncates the per-iteration length to u16 before using it for the transfer accounting. A request of 65536 sectors or more therefore computes len == 0, passes blkcount 0 to sceAtaExecCmd, and advances buf/lba/nsectors by zero - an infinite loop that never makes progress. Keep the iteration length in a u32 and only narrow it to u16 for the sector-count register, where 0 legitimately means 65536. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This was referenced Aug 27, 2026
Member
|
Looks good to me |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
ata_device_sector_io64narrows the per-iteration transfer length tou16before using it for the loop accounting. A request of 65536 sectors or more therefore computeslen == 0, passesblkcount0 tosceAtaExecCmd, and advancesbuf/lba/nsectorsby zero — an infinite loop that never makes progress.This change keeps the iteration length in a
u32(chunk) and only narrows tou16for the sector-count register, where 0 legitimately means 65536. The 28-bit path is expressed the same way for consistency; its behaviour is unchanged (max 256).Found while characterizing large GPT/exFAT drives on clone network adapters (measurements and test tooling: https://github.com/LAP87/ps2-gamestar-pio), but the defect is independent of adapter type — any BDM/APA caller requesting ≥ 32 MiB in one call hits it.
🤖 Generated with Claude Code