Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev avoid doing extra work by just zeroing/printing real...



details:   https://anonhg.NetBSD.org/src/rev/f564c01d8856
branches:  trunk
changeset: 748925:f564c01d8856
user:      christos <christos%NetBSD.org@localhost>
date:      Tue Nov 10 20:39:36 2009 +0000

description:
avoid doing extra work by just zeroing/printing real blocksize.

diffstat:

 sys/dev/cgd.c |  14 +++++++-------
 1 files changed, 7 insertions(+), 7 deletions(-)

diffs (56 lines):

diff -r dee36d907a50 -r f564c01d8856 sys/dev/cgd.c
--- a/sys/dev/cgd.c     Tue Nov 10 20:24:50 2009 +0000
+++ b/sys/dev/cgd.c     Tue Nov 10 20:39:36 2009 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: cgd.c,v 1.63 2009/11/10 20:24:30 christos Exp $ */
+/* $NetBSD: cgd.c,v 1.64 2009/11/10 20:39:36 christos Exp $ */
 
 /*-
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cgd.c,v 1.63 2009/11/10 20:24:30 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cgd.c,v 1.64 2009/11/10 20:39:36 christos Exp $");
 
 #include <sys/types.h>
 #include <sys/param.h>
@@ -796,7 +796,7 @@
        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;
@@ -815,13 +815,13 @@
                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);
@@ -830,10 +830,10 @@
                }
 
                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;



Home | Main Index | Thread Index | Old Index