All of lore.kernel.org
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: Herbert Xu <herbert@gondor.apana.org.au>,
	kernel test robot <lkp@intel.com>
Cc: Kai Ye <yekai13@huawei.com>,
	kbuild-all@lists.01.org, linux-kernel@vger.kernel.org,
	Linux Crypto Mailing List <linux-crypto@vger.kernel.org>
Subject: Re: crypto: hisilicon - Fix sscanf format signedness
Date: Fri, 27 Aug 2021 12:33:39 -0700	[thread overview]
Message-ID: <e25f996113e08e37dbfbc3c8ef985ce9423e710f.camel@perches.com> (raw)
In-Reply-To: <20210827084310.GA21801@gondor.apana.org.au>

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)



WARNING: multiple messages have this Message-ID (diff)
From: Joe Perches <joe@perches.com>
To: kbuild-all@lists.01.org
Subject: Re: crypto: hisilicon - Fix sscanf format signedness
Date: Fri, 27 Aug 2021 12:33:39 -0700	[thread overview]
Message-ID: <e25f996113e08e37dbfbc3c8ef985ce9423e710f.camel@perches.com> (raw)
In-Reply-To: <20210827084310.GA21801@gondor.apana.org.au>

[-- Attachment #1: Type: text/plain, Size: 838 bytes --]

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)


  reply	other threads:[~2021-08-27 19:51 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-22  1:18 drivers/crypto/hisilicon/qm.c:4077:8: warning: %ld in format string (no. 1) requires 'long *' but the argument type is 'unsigned long *'. [invalidScanfArgType_int] kernel test robot
2021-08-22  1:18 ` kernel test robot
2021-08-27  8:43 ` crypto: hisilicon - Fix sscanf format signedness Herbert Xu
2021-08-27  8:43   ` Herbert Xu
2021-08-27 19:33   ` Joe Perches [this message]
2021-08-27 19:33     ` Joe Perches

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e25f996113e08e37dbfbc3c8ef985ce9423e710f.camel@perches.com \
    --to=joe@perches.com \
    --cc=herbert@gondor.apana.org.au \
    --cc=kbuild-all@lists.01.org \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lkp@intel.com \
    --cc=yekai13@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.