Re: [PATCH] ata: pata_ep93xx: fix incorrect return value in data_xfer

Damien Le Moal <[email protected]> Thu, 23 Jul 2026 16:41:26 +0900
Newsgroups org.kernel.vger.linux-ide,org.kernel.vger.linux-kernel
Organization Western Digital Research
Message-ID <[email protected]>
On 7/20/26 11:09, Rosen Penev wrote:
> The while (words--) loop post-decrements words, so it underflows from
> 0 to UINT_MAX on exit.  The function then returns "words << 1", which
> is either 0 (for odd-length transfers after words++) or 0xFFFFFFFE
> (for even-length transfers).  Callers like __atapi_pio_bytes() depend
> on the correct byte count to manage scatter-gather progress; a wrong
> value causes ATAPI PIO transfer errors.
> 
> Fix by returning ALIGN(buflen, 2) instead of the corrupted words
> counter, matching what ata_sff_data_xfer() effectively returns via
> its words counter.
> 
> Assisted-by: opencode:big-pickle
> Signed-off-by: Rosen Penev <[email protected]>

This does not apply cleanly. Please rebase on libata/for-7.3.

-- 
Damien Le Moal
Western Digital Research