test of 'good_bytes' in scsi_io_completion is always true (in drivers/scsi/scsi_lib.c)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



in drivers/scsi/scsi_lib.c::scsi_io_completion() 'good_bytes' is tested 
for being >= 0, but 'good_bytes' is an unsigned int, so that test is 
always true. My *guess* is that what was intended was to test if 
good_bytes is > 0, but I don't know this code well enough to be sure. 
The patch below makes the change to test if it's > 0, but if the code in 
the 'if' really wants to run if it's >= 0, then we might as well just 
remove the 'if'.

In any case, the current code looks fishy.


Signed-off-by: Jesper Juhl <juhl-lkml@xxxxxx>

--- linux-2.6.12-rc2-mm3-orig/drivers/scsi/scsi_lib.c	2005-04-11 21:20:49.000000000 +0200
+++ linux-2.6.12-rc2-mm3/drivers/scsi/scsi_lib.c	2005-04-20 00:29:14.000000000 +0200
@@ -766,7 +766,7 @@ void scsi_io_completion(struct scsi_cmnd
 	 * Next deal with any sectors which we were able to correctly
 	 * handle.
 	 */
-	if (good_bytes >= 0) {
+	if (good_bytes > 0) {
 		SCSI_LOG_HLCOMPLETE(1, printk("%ld sectors total, %d bytes done.\n",
 					      req->nr_sectors, good_bytes));
 		SCSI_LOG_HLCOMPLETE(1, printk("use_sg is %d\n", cmd->use_sg));




Please keep me on CC:


-
: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]
  Powered by Linux