Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/ic don't try to write in a const buffer.



details:   https://anonhg.NetBSD.org/src/rev/d976ad3cbf2b
branches:  trunk
changeset: 773477:d976ad3cbf2b
user:      christos <christos%NetBSD.org@localhost>
date:      Fri Feb 03 04:03:11 2012 +0000

description:
don't try to write in a const buffer.

diffstat:

 sys/dev/ic/tpm.c |  9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)

diffs (36 lines):

diff -r c7223faaec95 -r d976ad3cbf2b sys/dev/ic/tpm.c
--- a/sys/dev/ic/tpm.c  Fri Feb 03 03:54:35 2012 +0000
+++ b/sys/dev/ic/tpm.c  Fri Feb 03 04:03:11 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: tpm.c,v 1.4 2012/01/23 04:12:26 christos Exp $ */
+/*     $NetBSD: tpm.c,v 1.5 2012/02/03 04:03:11 christos Exp $ */
 /*
  * Copyright (c) 2008, 2009 Michael Shalayeff
  * Copyright (c) 2009, 2010 Hans-Jörg Höxer
@@ -18,9 +18,9 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: tpm.c,v 1.4 2012/01/23 04:12:26 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tpm.c,v 1.5 2012/02/03 04:03:11 christos Exp $");
 
-#if 0
+#if 1
 #define        TPM_DEBUG 
 #define aprint_debug_dev aprint_error_dev
 #endif
@@ -323,12 +323,13 @@
            0, 0, 0, 10,        /* Length in bytes */
            0, 0, 0, 156        /* TPM_ORD_SaveStates */
        };
+       uint8_t scratch[sizeof(command)];
 
        /*
         * Power down:  We have to issue the SaveStates command.
         */
        (*sc->sc_write)(sc, &command, sizeof(command));
-       (*sc->sc_read)(sc, &command, sizeof(command), NULL, TPM_HDRSIZE);
+       (*sc->sc_read)(sc, &scratch, sizeof(scratch), NULL, TPM_HDRSIZE);
 #ifdef TPM_DEBUG
        aprint_debug_dev(sc->sc_dev, "%s: power down\n", __func__);
 #endif



Home | Main Index | Thread Index | Old Index