Re: crypto: hisilicon - Fix sscanf format signedness

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, 2021-08-27 at 16:43 +0800, Herbert Xu wrote:
> The function qm_qos_value_init expects an unsigned integer but
> is incorrectly supplying a signed format to sscanf.  This patch
> fixes it.
[]
> diff --git a/drivers/crypto/hisilicon/qm.c b/drivers/crypto/hisilicon/qm.c
[]
> @@ -4191,7 +4191,7 @@ static ssize_t qm_qos_value_init(const char *buf, unsigned long *val)
>  			return -EINVAL;
>  	}
>  
> 
> -	ret = sscanf(buf, "%ld", val);
> +	ret = sscanf(buf, "%lu", val);
>  	if (ret != QM_QOS_VAL_NUM)
>  		return -EINVAL;

QM_QOS_VAL_NUM seems an especially silly define

A direct use of 1 would be _far_ better IMO.

$ git grep -w -n QM_QOS_VAL_NUM
drivers/crypto/hisilicon/qm.c:246:#define QM_QOS_VAL_NUM                        1
drivers/crypto/hisilicon/qm.c:4189:     if (ret != QM_QOS_VAL_NUM)





[Index of Archives]     [Kernel]     [Gnu Classpath]     [Gnu Crypto]     [DM Crypt]     [Netfilter]     [Bugtraq]

  Powered by Linux