]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
drivers: scsi: fix double decrement of block count in 64-bit LBA path
authorBalaji Selvanathan <balaji.selvanathan@oss.qualcomm.com>
Mon, 22 Dec 2025 09:01:05 +0000 (14:31 +0530)
committerTom Rini <trini@konsulko.com>
Mon, 22 Dec 2025 22:19:39 +0000 (16:19 -0600)
The scsi_read function incorrectly decrements the block count twice
when handling large disks that trigger the CONFIG_SYS_64BIT_LBA code
path (reads beyond block 268,435,455). The variable 'blks' was being
decremented both inside the 64-bit LBA block and after the successful
scsi_exec() call, causing incorrect block count tracking and data
abort errors on large capacity disks.

Signed-off-by: Balaji Selvanathan <balaji.selvanathan@oss.qualcomm.com>
Tested-by: Tony Dinh <mibodhi@gmail.com>
drivers/scsi/scsi.c

index b414d022f3fd531be85b7ac9d581dada07132ada..8fe6b38a8c748e9224dcbf075bcfac1dcec83219 100644 (file)
@@ -220,7 +220,6 @@ static ulong scsi_read(struct udevice *dev, lbaint_t blknr, lbaint_t blkcnt,
                        pccb->datalen = block_dev->blksz * blocks;
                        scsi_setup_read16(pccb, start, blocks);
                        start += blocks;
-                       blks -= blocks;
                } else
 #endif
                if (blks > max_blks) {