diff --git a/sys/dev/cgd.c b/sys/dev/cgd.c index 4c0f6048b15d..d09141f60c5a 100644 --- a/sys/dev/cgd.c +++ b/sys/dev/cgd.c @@ -1,4 +1,4 @@ -/* $NetBSD: cgd.c,v 1.59 2009/09/11 09:28:34 tron Exp $ */ +/* $NetBSD: cgd.c,v 1.60 2009/09/11 13:36:37 tron Exp $ */ /*- * Copyright (c) 2002 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: cgd.c,v 1.59 2009/09/11 09:28:34 tron Exp $"); +__KERNEL_RCSID(0, "$NetBSD: cgd.c,v 1.60 2009/09/11 13:36:37 tron Exp $"); #include #include @@ -792,7 +792,7 @@ cgd_cipher(struct cgd_softc *cs, void *dstv, void *srcv, DIAGCONDPANIC(sizeof(daddr_t) > blocksize, ("cgd_cipher: sizeof(daddr_t) > blocksize")); - memset(zero_iv, 0x0, sizeof(zero_iv)); + memset(zero_iv, 0x0, blocksize); dstuio.uio_iov = dstiov; dstuio.uio_iovcnt = 2; @@ -811,13 +811,13 @@ cgd_cipher(struct cgd_softc *cs, void *dstv, void *srcv, dstiov[1].iov_base = dst; srciov[1].iov_base = src; - memset(blkno_buf, 0x0, sizeof(blkno_buf)); + memset(blkno_buf, 0x0, blocksize); blkno2blkno_buf(blkno_buf, blkno); if (dir == CGD_CIPHER_DECRYPT) { dstuio.uio_iovcnt = 1; srcuio.uio_iovcnt = 1; IFDEBUG(CGDB_CRYPTO, hexprint("step 0: blkno_buf", - blkno_buf, sizeof(blkno_buf))); + blkno_buf, blocksize)); cipher(cs->sc_cdata.cf_priv, &dstuio, &srcuio, zero_iv, CGD_CIPHER_ENCRYPT); memcpy(blkno_buf, sink, blocksize); @@ -826,10 +826,10 @@ cgd_cipher(struct cgd_softc *cs, void *dstv, void *srcv, } IFDEBUG(CGDB_CRYPTO, hexprint("step 1: blkno_buf", - blkno_buf, sizeof(blkno_buf))); + blkno_buf, blocksize)); cipher(cs->sc_cdata.cf_priv, &dstuio, &srcuio, zero_iv, dir); IFDEBUG(CGDB_CRYPTO, hexprint("step 2: sink", - sink, sizeof(sink))); + sink, blocksize)); dst += secsize; src += secsize;