From: Joe Perches <joe@perches.com>
To: Joey Pabalinas <joeypabalinas@gmail.com>, linux-crypto@vger.kernel.org
Cc: herbert@gondor.apana.org.au, davem@davemloft.net,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] crypto: testmgr: change `guard` to unsigned char
Date: Mon, 01 Jan 2018 07:03:46 -0800 [thread overview]
Message-ID: <1514819026.1967.37.camel@perches.com> (raw)
In-Reply-To: <20180101103319.fmmlpeg6kjdmhloq@gmail.com>
On Mon, 2018-01-01 at 00:33 -1000, Joey Pabalinas wrote:
> 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.
[]
> diff --git 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 };
Might as well add static too
next prev parent reply other threads:[~2018-01-01 15:03 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 [this message]
2018-01-01 20:36 ` Joey Pabalinas
2018-01-01 20:40 ` [PATCH v2] " Joey Pabalinas
2018-01-12 12:23 ` 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=1514819026.1967.37.camel@perches.com \
--to=joe@perches.com \
--cc=davem@davemloft.net \
--cc=herbert@gondor.apana.org.au \
--cc=joeypabalinas@gmail.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