]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commitdiff
crypto: testmgr - change `guard` to unsigned char
authorJoey Pabalinas <joeypabalinas@gmail.com>
Mon, 1 Jan 2018 20:40:14 +0000 (10:40 -1000)
committerHerbert Xu <herbert@gondor.apana.org.au>
Fri, 12 Jan 2018 12:03:05 +0000 (23:03 +1100)
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>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
crypto/testmgr.c

index 29d7020b8826faa3f0b58897e4d30cd5d9de9d49..44a85d4b3561acbca6b3b393dc255c9d58ff9235 100644 (file)
@@ -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(