From: Nathan Chancellor <nathan@kernel.org>
To: trix@redhat.com
Cc: wangzhou1@hisilicon.com, herbert@gondor.apana.org.au,
davem@davemloft.net, ndesaulniers@google.com,
linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org,
llvm@lists.linux.dev
Subject: Re: [PATCH] crypto: cleanup warning in qm_get_qos_value()
Date: Tue, 21 Dec 2021 14:31:14 -0700 [thread overview]
Message-ID: <YcJHoqXXVFZatIla@archlinux-ax161> (raw)
In-Reply-To: <20211221205953.3128923-1-trix@redhat.com>
On Tue, Dec 21, 2021 at 12:59:53PM -0800, trix@redhat.com wrote:
> From: Tom Rix <trix@redhat.com>
>
> Building with clang static analysis returns this warning:
>
> qm.c:4382:11: warning: The left operand of '==' is a garbage value
> if (*val == 0 || *val > QM_QOS_MAX_VAL || ret) {
> ~~~~ ^
>
> The call to qm_qos_value_init() can return an error without setting
> *val. So check ret before checking *val.
>
> Signed-off-by: Tom Rix <trix@redhat.com>
Reviewed-by: Nathan Chancellor <nathan@kernel.org>
Should this have a fixes tag?
Fixes: 72b010dc33b9 ("crypto: hisilicon/qm - supports writing QoS int the host")
> ---
> drivers/crypto/hisilicon/qm.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/crypto/hisilicon/qm.c b/drivers/crypto/hisilicon/qm.c
> index b1fe9c7b8cc89..c906f2e59277b 100644
> --- a/drivers/crypto/hisilicon/qm.c
> +++ b/drivers/crypto/hisilicon/qm.c
> @@ -4379,7 +4379,7 @@ static ssize_t qm_get_qos_value(struct hisi_qm *qm, const char *buf,
> return -EINVAL;
>
> ret = qm_qos_value_init(val_buf, val);
> - if (*val == 0 || *val > QM_QOS_MAX_VAL || ret) {
> + if (ret || *val == 0 || *val > QM_QOS_MAX_VAL) {
> pci_err(qm->pdev, "input qos value is error, please set 1~1000!\n");
> return -EINVAL;
> }
> --
> 2.26.3
>
next prev parent reply other threads:[~2021-12-21 21:31 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-21 20:59 [PATCH] crypto: cleanup warning in qm_get_qos_value() trix
2021-12-21 21:31 ` Nathan Chancellor [this message]
2021-12-22 14:46 ` Tom Rix
2021-12-22 1:44 ` Zhou Wang
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=YcJHoqXXVFZatIla@archlinux-ax161 \
--to=nathan@kernel.org \
--cc=davem@davemloft.net \
--cc=herbert@gondor.apana.org.au \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=llvm@lists.linux.dev \
--cc=ndesaulniers@google.com \
--cc=trix@redhat.com \
--cc=wangzhou1@hisilicon.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox