From: Dan Carpenter Date: Sat, 8 Dec 2018 05:06:12 +0000 (-0700) Subject: scsi: Fix a harmless double shift bug X-Git-Url: http://git.cdn.openwrt.org/?a=commitdiff_plain;h=29cadd2bb6670405086b177120593c1291273fb9;p=openwrt%2Fstaging%2Fblogic.git scsi: Fix a harmless double shift bug Smatch generates a warning: drivers/scsi/scsi_lib.c:1656 scsi_mq_done() warn: test_bit() takes a bit number The problem is that SCMD_STATE_COMPLETE is supposed to be bit number 0 and not a mask like "(1 << 0)". It is used like this: if (test_and_set_bit(SCMD_STATE_COMPLETE, &scmd->state)) The test_and_set_bit() has a shift built in so it's a double left shift and uses bit number 1 instead of number 0. This bug is harmless because it's done consistently and it doesn't clash with any other flags. Fixes: f1342709d18a ("scsi: Do not rely on blk-mq for double completions") Reviewed-by: Keith Busch Acked-by: Martin K. Petersen Signed-off-by: Dan Carpenter Signed-off-by: Jens Axboe --- diff --git a/include/scsi/scsi_cmnd.h b/include/scsi/scsi_cmnd.h index 3de905e205ce..d85e6befa26b 100644 --- a/include/scsi/scsi_cmnd.h +++ b/include/scsi/scsi_cmnd.h @@ -62,7 +62,7 @@ struct scsi_pointer { #define SCMD_PRESERVED_FLAGS (SCMD_UNCHECKED_ISA_DMA | SCMD_INITIALIZED) /* for scmd->state */ -#define SCMD_STATE_COMPLETE (1 << 0) +#define SCMD_STATE_COMPLETE 0 struct scsi_cmnd { struct scsi_request req;