From: Joey Pabalinas <joeypabalinas@gmail.com>
To: Joe Perches <joe@perches.com>, linux-crypto@vger.kernel.org
Cc: herbert@gondor.apana.org.au, davem@davemloft.net,
linux-kernel@vger.kernel.org,
Joey Pabalinas <joeypabalinas@gmail.com>
Subject: [PATCH v2] crypto: testmgr: change `guard` to unsigned char
Date: Mon, 1 Jan 2018 10:40:14 -1000 [thread overview]
Message-ID: <20180101204014.643vntmxqdbfqmvb@gmail.com> (raw)
In-Reply-To: <1514819026.1967.37.camel@perches.com>
[-- Attachment #1: Type: text/plain, Size: 874 bytes --]
When char is signed, storing the values 0xba (186) and 0xad (173) in the
`guard` array produces signed overflow. Change the type of `guard` to
static unsigned char to correct undefined behavior and reduce function
stack usage.
Signed-off-by: Joey Pabalinas <joeypabalinas@gmail.com>
---
crypto/testmgr.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/crypto/testmgr.c b/crypto/testmgr.c
index 29d7020b8826faa3f0..44a85d4b3561acbca6 100644
--- a/crypto/testmgr.c
+++ b/crypto/testmgr.c
@@ -185,7 +185,7 @@ static int ahash_partial_update(struct ahash_request **preq,
char *state;
struct ahash_request *req;
int statesize, ret = -EINVAL;
- const char guard[] = { 0x00, 0xba, 0xad, 0x00 };
+ static const unsigned char guard[] = { 0x00, 0xba, 0xad, 0x00 };
req = *preq;
statesize = crypto_ahash_statesize(
--
2.15.1
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
next prev parent reply other threads:[~2018-01-01 20:40 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-01 10:33 [PATCH] crypto: testmgr: change `guard` to unsigned char Joey Pabalinas
2018-01-01 15:03 ` Joe Perches
2018-01-01 20:36 ` Joey Pabalinas
2018-01-01 20:40 ` Joey Pabalinas [this message]
2018-01-12 12:23 ` [PATCH v2] " Herbert Xu
2018-01-12 17:09 ` Joey Pabalinas
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=20180101204014.643vntmxqdbfqmvb@gmail.com \
--to=joeypabalinas@gmail.com \
--cc=davem@davemloft.net \
--cc=herbert@gondor.apana.org.au \
--cc=joe@perches.com \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/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).