[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20180101204014.643vntmxqdbfqmvb@gmail.com>
Date: Mon, 1 Jan 2018 10:40:14 -1000
From: Joey Pabalinas <joeypabalinas@...il.com>
To: Joe Perches <joe@...ches.com>, linux-crypto@...r.kernel.org
Cc: herbert@...dor.apana.org.au, davem@...emloft.net,
linux-kernel@...r.kernel.org,
Joey Pabalinas <joeypabalinas@...il.com>
Subject: [PATCH v2] crypto: testmgr: change `guard` to unsigned char
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@...il.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
Download attachment "signature.asc" of type "application/pgp-signature" (834 bytes)
Powered by blists - more mailing lists