From: Dan Carpenter <dan.carpenter@oracle.com>
To: Tadeusz Struk <tadeusz.struk@intel.com>
Cc: Herbert Xu <herbert@gondor.apana.org.au>,
"David S. Miller" <davem@davemloft.net>,
"Allan, Bruce W" <bruce.w.allan@intel.com>,
Ahsan Atta <ahsan.atta@intel.com>,
qat-linux@intel.com, linux-crypto@vger.kernel.org,
kernel-janitors@vger.kernel.org
Subject: [patch] crypto: qat - silence a static checker warning
Date: Fri, 21 Aug 2015 11:47:45 +0300 [thread overview]
Message-ID: <20150821084745.GB25369@mwanda> (raw)
My static checker assumes that if we are getting numbers as a string
using kstrotoint() then that means they come from outside the kernel and
are untrustworthy.
This may or may not be true in this case, but it seems harmless to add
a range check here.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
diff --git a/drivers/crypto/qat/qat_common/adf_transport.c b/drivers/crypto/qat/qat_common/adf_transport.c
index d5d8198..ec3abf9 100644
--- a/drivers/crypto/qat/qat_common/adf_transport.c
+++ b/drivers/crypto/qat/qat_common/adf_transport.c
@@ -264,6 +264,10 @@ int adf_create_ring(struct adf_accel_dev *accel_dev, const char *section,
dev_err(&GET_DEV(accel_dev), "Can't get ring number\n");
return -EFAULT;
}
+ if (ring_num >= ARRAY_SIZE(bank->rings)) {
+ dev_err(&GET_DEV(accel_dev), "Invalid ring number\n");
+ return -EFAULT;
+ }
bank = &transport_data->banks[bank_num];
if (adf_reserve_ring(bank, ring_num)) {
next reply other threads:[~2015-08-21 8:47 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-21 8:47 Dan Carpenter [this message]
2015-08-22 15:29 ` [patch] crypto: qat - silence a static checker warning Tadeusz Struk
2015-08-24 14:24 ` Herbert Xu
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=20150821084745.GB25369@mwanda \
--to=dan.carpenter@oracle.com \
--cc=ahsan.atta@intel.com \
--cc=bruce.w.allan@intel.com \
--cc=davem@davemloft.net \
--cc=herbert@gondor.apana.org.au \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-crypto@vger.kernel.org \
--cc=qat-linux@intel.com \
--cc=tadeusz.struk@intel.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;
as well as URLs for NNTP newsgroup(s).