diff options
author | Conrad Meyer <cem@FreeBSD.org> | 2018-04-03 22:11:39 +0000 |
---|---|---|
committer | Conrad Meyer <cem@FreeBSD.org> | 2018-04-03 22:11:39 +0000 |
commit | 5d7ae54a5dddcdafadaf074cf4f893b4fb0a103c (patch) | |
tree | 191d76ba86426cd6474185acf2bb2dc3c21ed7d8 /sys/opencrypto/cryptosoft.c | |
parent | 526de79be2dfc252bd6e527c7adeb96b9a99b349 (diff) | |
download | src-5d7ae54a5dddcdafadaf074cf4f893b4fb0a103c.tar.gz src-5d7ae54a5dddcdafadaf074cf4f893b4fb0a103c.zip |
cryptosoft: Remove a dead store
Introduced in r331639 by removing an instance of undefined behavior.
While we're here, the variable scope can be entirely moved inside the loop.
Reported by: Coverity
CID: 1387985
Sponsored by: Dell EMC Isilon
Notes
Notes:
svn path=/head/; revision=331959
Diffstat (limited to 'sys/opencrypto/cryptosoft.c')
-rw-r--r-- | sys/opencrypto/cryptosoft.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/sys/opencrypto/cryptosoft.c b/sys/opencrypto/cryptosoft.c index f85f63e92a7c..45dc4d4957f0 100644 --- a/sys/opencrypto/cryptosoft.c +++ b/sys/opencrypto/cryptosoft.c @@ -84,7 +84,7 @@ static int swcr_encdec(struct cryptodesc *crd, struct swcr_data *sw, caddr_t buf, int flags) { - unsigned char iv[EALG_MAX_BLOCK_LEN], blk[EALG_MAX_BLOCK_LEN], *idat; + unsigned char iv[EALG_MAX_BLOCK_LEN], blk[EALG_MAX_BLOCK_LEN]; unsigned char *ivp, *nivp, iv2[EALG_MAX_BLOCK_LEN]; struct enc_xform *exf; int i, j, k, blks, ind, count, ivlen; @@ -249,11 +249,12 @@ swcr_encdec(struct cryptodesc *crd, struct swcr_data *sw, caddr_t buf, } while (uio->uio_iov[ind].iov_len >= k + blks && i > 0) { + uint8_t *idat; size_t nb, rem; nb = blks; rem = uio->uio_iov[ind].iov_len - k; - idat = (char *)uio->uio_iov[ind].iov_base + k; + idat = (uint8_t *)uio->uio_iov[ind].iov_base + k; if (exf->reinit) { if ((crd->crd_flags & CRD_F_ENCRYPT) != 0 && @@ -296,7 +297,6 @@ swcr_encdec(struct cryptodesc *crd, struct swcr_data *sw, caddr_t buf, ivp = nivp; } - idat += nb; count += nb; k += nb; i -= nb; |