svn commit: r331959 - head/sys/opencrypto
Conrad Meyer
cem at FreeBSD.org
Tue Apr 3 22:11:39 UTC 2018
Author: cem
Date: Tue Apr 3 22:11:39 2018
New Revision: 331959
URL: https://svnweb.freebsd.org/changeset/base/331959
Log:
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
Modified:
head/sys/opencrypto/cryptosoft.c
Modified: head/sys/opencrypto/cryptosoft.c
==============================================================================
--- head/sys/opencrypto/cryptosoft.c Tue Apr 3 22:10:50 2018 (r331958)
+++ head/sys/opencrypto/cryptosoft.c Tue Apr 3 22:11:39 2018 (r331959)
@@ -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 *
}
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 *
ivp = nivp;
}
- idat += nb;
count += nb;
k += nb;
i -= nb;
More information about the svn-src-all
mailing list