On Fri, Nov 13, 2015 at 3:23 PM, Dan Carpenter wrote:
> 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: Dan Carpenter
> ---
> Checkpatch has several complaints about this code but I left it as-is.
>
> diff --git a/drivers/scsi/mvsas/mv_init.c b/drivers/scsi/mvsas/mv_init.c
> index 90fdf0e..675e7fa 100644
> --- a/drivers/scsi/mvsas/mv_init.c
> +++ b/drivers/scsi/mvsas/mv_init.c
> @@ -758,7 +758,7 @@ mvs_store_interrupt_coalescing(struct device *cdev,
> struct device_attribute *attr,
> const char *buffer, size_t size)
> {
> - int val = 0;
> + unsigned int val = 0;
> struct mvs_info *mvi = NULL;
> struct Scsi_Host *shost = class_to_shost(cdev);
> struct sas_ha_struct *sha = SHOST_TO_SAS_HA(shost);
> @@ -766,7 +766,7 @@ mvs_store_interrupt_coalescing(struct device *cdev,
> if (buffer == NULL)
> return size;
>
> - if (sscanf(buffer, "%d", &val) != 1)
> + if (sscanf(buffer, "%u", &val) != 1)
> return -EINVAL;
>
> if (val >= 0x1) {
Looks good to me.
Reviewed-by: Jack Wang
--
Mit freundlichen Grüßen,
Best Regards,
Jack Wang
Linux Kernel Developer Storage
ProfitBricks GmbH The IaaS-Company.
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html