Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

scsi: core: Fix the scsi_set_resid() documentation

Because scsi_finish_command() subtracts the residual from the buffer
length, residual overflows must not be reported. Reflect this in the SCSI
documentation. See also commit 9237f04e12cc ("scsi: core: Fix
scsi_get/set_resid() interface")

Cc: Damien Le Moal <dlemoal@kernel.org>
Cc: Hannes Reinecke <hare@suse.de>
Cc: Douglas Gilbert <dgilbert@interlog.com>
Cc: stable@vger.kernel.org
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Link: https://lore.kernel.org/r/20230721160154.874010-2-bvanassche@acm.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>

authored by

Bart Van Assche and committed by
Martin K. Petersen
f669b8a6 0645ab15

+2 -2
+2 -2
Documentation/scsi/scsi_mid_low_api.rst
··· 1190 1190 - pointer to scsi_device object that this command is 1191 1191 associated with. 1192 1192 resid 1193 - - an LLD should set this signed integer to the requested 1193 + - an LLD should set this unsigned integer to the requested 1194 1194 transfer length (i.e. 'request_bufflen') less the number 1195 1195 of bytes that are actually transferred. 'resid' is 1196 1196 preset to 0 so an LLD can ignore it if it cannot detect 1197 - underruns (overruns should be rare). If possible an LLD 1197 + underruns (overruns should not be reported). An LLD 1198 1198 should set 'resid' prior to invoking 'done'. The most 1199 1199 interesting case is data transfers from a SCSI target 1200 1200 device (e.g. READs) that underrun.