kernel-janitors.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] scsi: qla2xxx: don't allow negative thresholds
@ 2018-09-20 10:02 Dan Carpenter
  2018-09-26 16:26 ` Madhani, Himanshu
  2018-09-27 23:51 ` Martin K. Petersen
  0 siblings, 2 replies; 3+ messages in thread
From: Dan Carpenter @ 2018-09-20 10:02 UTC (permalink / raw)
  To: kernel-janitors

We shouldn't allow negative thresholds.  I don't know what it would do
but it can't be good.

Fixes: 8b4673ba3a1b ("scsi: qla2xxx: Add support for ZIO6 interrupt threshold")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/drivers/scsi/qla2xxx/qla_attr.c b/drivers/scsi/qla2xxx/qla_attr.c
index a31d23905753..b28f159fdaee 100644
--- a/drivers/scsi/qla2xxx/qla_attr.c
+++ b/drivers/scsi/qla2xxx/qla_attr.c
@@ -1228,7 +1228,7 @@ qla_zio_threshold_store(struct device *dev, struct device_attribute *attr,
 		return -EINVAL;
 	if (sscanf(buf, "%d", &val) != 1)
 		return -EINVAL;
-	if (val > 256)
+	if (val < 0 || val > 256)
 		return -ERANGE;
 
 	atomic_set(&vha->hw->zio_threshold, val);

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

* Re: [PATCH] scsi: qla2xxx: don't allow negative thresholds
  2018-09-20 10:02 [PATCH] scsi: qla2xxx: don't allow negative thresholds Dan Carpenter
@ 2018-09-26 16:26 ` Madhani, Himanshu
  2018-09-27 23:51 ` Martin K. Petersen
  1 sibling, 0 replies; 3+ messages in thread
From: Madhani, Himanshu @ 2018-09-26 16:26 UTC (permalink / raw)
  To: kernel-janitors


> On Sep 20, 2018, at 3:02 AM, Dan Carpenter <dan.carpenter@oracle.com> wrote:
> 
> External Email
> 
> We shouldn't allow negative thresholds.  I don't know what it would do
> but it can't be good.
> 
> Fixes: 8b4673ba3a1b ("scsi: qla2xxx: Add support for ZIO6 interrupt threshold")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> 
> diff --git a/drivers/scsi/qla2xxx/qla_attr.c b/drivers/scsi/qla2xxx/qla_attr.c
> index a31d23905753..b28f159fdaee 100644
> --- a/drivers/scsi/qla2xxx/qla_attr.c
> +++ b/drivers/scsi/qla2xxx/qla_attr.c
> @@ -1228,7 +1228,7 @@ qla_zio_threshold_store(struct device *dev, struct device_attribute *attr,
>                return -EINVAL;
>        if (sscanf(buf, "%d", &val) != 1)
>                return -EINVAL;
> -       if (val > 256)
> +       if (val < 0 || val > 256)
>                return -ERANGE;
> 
>        atomic_set(&vha->hw->zio_threshold, val);

Looks Good. 

Acked-by: Himanshu Madhani <himanshu.madhani@cavium.com>

Thanks,
- Himanshu

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

* Re: [PATCH] scsi: qla2xxx: don't allow negative thresholds
  2018-09-20 10:02 [PATCH] scsi: qla2xxx: don't allow negative thresholds Dan Carpenter
  2018-09-26 16:26 ` Madhani, Himanshu
@ 2018-09-27 23:51 ` Martin K. Petersen
  1 sibling, 0 replies; 3+ messages in thread
From: Martin K. Petersen @ 2018-09-27 23:51 UTC (permalink / raw)
  To: kernel-janitors


Dan,

> We shouldn't allow negative thresholds.  I don't know what it would do
> but it can't be good.

Applied to 4.20/scsi-queue, thanks!

-- 
Martin K. Petersen	Oracle Linux Engineering

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

end of thread, other threads:[~2018-09-27 23:51 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-09-20 10:02 [PATCH] scsi: qla2xxx: don't allow negative thresholds Dan Carpenter
2018-09-26 16:26 ` Madhani, Himanshu
2018-09-27 23:51 ` Martin K. Petersen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).