scsi: scsi_debug: fix an error handling bug in sdeb_zbc_model_str()
Subsystems (2)
PATCH 1/1 scsi: scsi_debug: fix an error handling bug in sdeb_zbc_model_str()
This test is checking the wrong variable. It should be testing "ret". The "sdeb_zbc_model" variable is an enum (unsigned in this situation) and we never assign negative values to it.
--- drivers/scsi/scsi_debug.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/scsi_debug.c +1 -1
@@ -6460,7 +6460,7 @@ static int sdeb_zbc_model_str(const char *cp) res =sysfs_match_string (zbc_model_strs_b, cp);if (res <0 ) { res =sysfs_match_string (zbc_model_strs_c, cp); -if (sdeb_zbc_model <0 ) +if (res <0 )return -EINVAL ; } }
Signature · 1 line
2.26.2
Quoted 6 lines · Dan Carpenter
This test is checking the wrong variable. It should be testing "ret". The "
sdeb_zbc_model" variable is an enum (unsigned in this situation) and we never assign negative values to it.Fixes 9267e0eb41fe ("scsi: scsi_debug: Add ZBC module parameter")Signed-off-by Dan Carpenter <[email protected]>
s/ret/res/ at the end of the first line above.
Quoted 18 lines
--- drivers/scsi/scsi_debug.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/scsi/scsi_debug.c +1
-1@@ -6460,7 +6460,7 @@ static int sdeb_zbc_model_str(const char *cp) res =sysfs_match_string (zbc_model_strs_b, cp);if (res <0 ) { res =sysfs_match_string (zbc_model_strs_c, cp); -if (sdeb_zbc_model <0 ) +if (res <0 )return -EINVAL ; } }
Martin K. Petersen
AppliedQuoted 3 lines · Dan Carpenter
This test is checking the wrong variable. It should be testing "ret". The "
sdeb_zbc_model" variable is an enum (unsigned in this situation) and we never assign negative values to it.
Applied to 5.8/scsi-queue, thanks!
[1/1] scsi: scsi_debug: Fix an error handling bug in sdeb_zbc_model_str()
https://git.kernel.org/mkp/scsi/c/47742bde281b
Signature · 1 line
Martin K. Petersen Oracle Linux Engineering