All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] scsi: scsi_debug: fix an error handling bug in sdeb_zbc_model_str()
@ 2020-05-09 10:04 ` Dan Carpenter
  0 siblings, 0 replies; 6+ messages in thread
From: Dan Carpenter @ 2020-05-09 10:04 UTC (permalink / raw)
  To: James E.J. Bottomley, Douglas Gilbert
  Cc: Martin K. Petersen, linux-scsi, kernel-janitors

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 <dan.carpenter@oracle.com>
---
 drivers/scsi/scsi_debug.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/scsi_debug.c b/drivers/scsi/scsi_debug.c
index 105e563d87b4e..73847366dc495 100644
--- a/drivers/scsi/scsi_debug.c
+++ b/drivers/scsi/scsi_debug.c
@@ -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;
 		}
 	}
-- 
2.26.2

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH] scsi: scsi_debug: fix an error handling bug in sdeb_zbc_model_str()
@ 2020-05-09 10:04 ` Dan Carpenter
  0 siblings, 0 replies; 6+ messages in thread
From: Dan Carpenter @ 2020-05-09 10:04 UTC (permalink / raw)
  To: James E.J. Bottomley, Douglas Gilbert
  Cc: Martin K. Petersen, linux-scsi, kernel-janitors

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 <dan.carpenter@oracle.com>
---
 drivers/scsi/scsi_debug.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/scsi_debug.c b/drivers/scsi/scsi_debug.c
index 105e563d87b4e..73847366dc495 100644
--- a/drivers/scsi/scsi_debug.c
+++ b/drivers/scsi/scsi_debug.c
@@ -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;
 		}
 	}
-- 
2.26.2


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] scsi: scsi_debug: fix an error handling bug in sdeb_zbc_model_str()
  2020-05-09 10:04 ` Dan Carpenter
@ 2020-05-09 14:45   ` Douglas Gilbert
  -1 siblings, 0 replies; 6+ messages in thread
From: Douglas Gilbert @ 2020-05-09 14:45 UTC (permalink / raw)
  To: Dan Carpenter, James E.J. Bottomley
  Cc: Martin K. Petersen, linux-scsi, kernel-janitors

On 2020-05-09 6:04 a.m., Dan Carpenter wrote:
> 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 <dan.carpenter@oracle.com>

s/ret/res/ at the end of the first line above.

Acked-by: Douglas Gilbert <dgilbert@interlog.com>

> ---
>   drivers/scsi/scsi_debug.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/scsi/scsi_debug.c b/drivers/scsi/scsi_debug.c
> index 105e563d87b4e..73847366dc495 100644
> --- a/drivers/scsi/scsi_debug.c
> +++ b/drivers/scsi/scsi_debug.c
> @@ -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;
>   		}
>   	}
> 

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] scsi: scsi_debug: fix an error handling bug in sdeb_zbc_model_str()
@ 2020-05-09 14:45   ` Douglas Gilbert
  0 siblings, 0 replies; 6+ messages in thread
From: Douglas Gilbert @ 2020-05-09 14:45 UTC (permalink / raw)
  To: Dan Carpenter, James E.J. Bottomley
  Cc: Martin K. Petersen, linux-scsi, kernel-janitors

On 2020-05-09 6:04 a.m., Dan Carpenter wrote:
> 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 <dan.carpenter@oracle.com>

s/ret/res/ at the end of the first line above.

Acked-by: Douglas Gilbert <dgilbert@interlog.com>

> ---
>   drivers/scsi/scsi_debug.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/scsi/scsi_debug.c b/drivers/scsi/scsi_debug.c
> index 105e563d87b4e..73847366dc495 100644
> --- a/drivers/scsi/scsi_debug.c
> +++ b/drivers/scsi/scsi_debug.c
> @@ -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;
>   		}
>   	}
> 


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] scsi: scsi_debug: fix an error handling bug in sdeb_zbc_model_str()
  2020-05-09 10:04 ` Dan Carpenter
@ 2020-05-12  3:28   ` Martin K. Petersen
  -1 siblings, 0 replies; 6+ messages in thread
From: Martin K. Petersen @ 2020-05-12  3:28 UTC (permalink / raw)
  To: James E.J. Bottomley, Dan Carpenter, Douglas Gilbert
  Cc: Martin K . Petersen, kernel-janitors, linux-scsi

On Sat, 9 May 2020 13:04:08 +0300, Dan Carpenter wrote:

> 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

-- 
Martin K. Petersen	Oracle Linux Engineering

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] scsi: scsi_debug: fix an error handling bug in sdeb_zbc_model_str()
@ 2020-05-12  3:28   ` Martin K. Petersen
  0 siblings, 0 replies; 6+ messages in thread
From: Martin K. Petersen @ 2020-05-12  3:28 UTC (permalink / raw)
  To: James E.J. Bottomley, Dan Carpenter, Douglas Gilbert
  Cc: Martin K . Petersen, kernel-janitors, linux-scsi

On Sat, 9 May 2020 13:04:08 +0300, Dan Carpenter wrote:

> 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

-- 
Martin K. Petersen	Oracle Linux Engineering

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2020-05-12  3:28 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-05-09 10:04 [PATCH] scsi: scsi_debug: fix an error handling bug in sdeb_zbc_model_str() Dan Carpenter
2020-05-09 10:04 ` Dan Carpenter
2020-05-09 14:45 ` Douglas Gilbert
2020-05-09 14:45   ` Douglas Gilbert
2020-05-12  3:28 ` Martin K. Petersen
2020-05-12  3:28   ` Martin K. Petersen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.