Skip to contentSkip to conversation

scsi: qla2xxx: don't allow negative thresholds

PATCH Applied Dan Carpenter 3 participants 3 messages Sep 20, 2018 – Sep 27, 2018

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 scsi: qla2xxx: don't allow negative thresholds

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")
drivers/scsi/qla2xxx/qla_attr.c +1 -1
index a31d23905753..b28f159fdaee 100644
@@ -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);
Acked-by on v1 1/1
#1 lore raw
Quoted 16 lines · Dan Carpenter

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")
drivers/scsi/qla2xxx/qla_attr.c +0 -0
index a31d23905753..b28f159fdaee 100644

drivers/scsi/qla2xxx/qla_attr.c qla_zio_threshold_store(struct device *dev, struct device_attribute *attr, · line 1234

Quoted 8 lines
drivers/scsi/qla2xxx/qla_attr.c +1 -1
@@ -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.

Thanks,
- Himanshu

#2 lore raw
In reply to Dan Carpenter

Dan,

Quoted 2 lines

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!

Signature · 1 line
Martin K. Petersen	Oracle Linux Engineering