Commit 78b7b80c authored by Dan Carpenter's avatar Dan Carpenter Committed by Martin K. Petersen

mvsas: don't allow negative timeouts

There is a static checker warning here because "val" is controlled by
the user and we have a upper bound on it but allow negative numbers.
"val" appears to be a timeout in usec so this bug probably means we
have a longer timeout than we should.  Let's fix this by changing "val"
to unsigned.
Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: default avatarJack Wang <jinpu.wang@profitbricks.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent 15de0de2
...@@ -759,7 +759,7 @@ mvs_store_interrupt_coalescing(struct device *cdev, ...@@ -759,7 +759,7 @@ mvs_store_interrupt_coalescing(struct device *cdev,
struct device_attribute *attr, struct device_attribute *attr,
const char *buffer, size_t size) const char *buffer, size_t size)
{ {
int val = 0; unsigned int val = 0;
struct mvs_info *mvi = NULL; struct mvs_info *mvi = NULL;
struct Scsi_Host *shost = class_to_shost(cdev); struct Scsi_Host *shost = class_to_shost(cdev);
struct sas_ha_struct *sha = SHOST_TO_SAS_HA(shost); struct sas_ha_struct *sha = SHOST_TO_SAS_HA(shost);
...@@ -767,7 +767,7 @@ mvs_store_interrupt_coalescing(struct device *cdev, ...@@ -767,7 +767,7 @@ mvs_store_interrupt_coalescing(struct device *cdev,
if (buffer == NULL) if (buffer == NULL)
return size; return size;
if (sscanf(buffer, "%d", &val) != 1) if (sscanf(buffer, "%u", &val) != 1)
return -EINVAL; return -EINVAL;
if (val >= 0x10000) { if (val >= 0x10000) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment