lkml.org 
[lkml]   [2018]   [Jan]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH] 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
unsigned char to remove undefined behavior.

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..e9a9faecf212bbd742 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 };
+ const unsigned char guard[] = { 0x00, 0xba, 0xad, 0x00 };

req = *preq;
statesize = crypto_ahash_statesize(
--
2.15.1[unhandled content-type:application/pgp-signature]
\
 
 \ /
  Last update: 2018-01-01 11:34    [W:0.093 / U:0.304 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site