Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/ieee1394 Make sure and zero out the malloc'd abufs b...



details:   https://anonhg.NetBSD.org/src/rev/8cd5535d8f80
branches:  trunk
changeset: 509830:8cd5535d8f80
user:      jmc <jmc%NetBSD.org@localhost>
date:      Mon May 14 05:46:41 2001 +0000

description:
Make sure and zero out the malloc'd abufs before using them.

diffstat:

 sys/dev/ieee1394/fwnode.c |  7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diffs (30 lines):

diff -r 881403ad4b57 -r 8cd5535d8f80 sys/dev/ieee1394/fwnode.c
--- a/sys/dev/ieee1394/fwnode.c Mon May 14 03:20:10 2001 +0000
+++ b/sys/dev/ieee1394/fwnode.c Mon May 14 05:46:41 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: fwnode.c,v 1.4 2001/05/11 06:09:01 jmc Exp $   */
+/*     $NetBSD: fwnode.c,v 1.5 2001/05/14 05:46:41 jmc Exp $   */
 
 /*
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -1013,8 +1013,11 @@
        u_int32_t loc = ((int32_t *)devcap->dev_data)[0];
        
        ab = malloc(sizeof(struct ieee1394_abuf), M_1394DATA, M_WAITOK);
+       memset(ab, 0, sizeof(struct ieee1394_abuf));
        ab->ab_data = malloc(8, M_1394DATA, M_WAITOK);
+       memset(ab->ab_data, 0, 8);
        ab2 = malloc(sizeof(struct ieee1394_abuf), M_1394DATA, M_WAITOK);
+       memset(ab2, 0, sizeof(struct ieee1394_abuf));
        
        loc *= 4;
        ab->ab_length = 8;
@@ -1062,6 +1065,8 @@
        ab->ab_data = malloc(32, M_1394DATA, M_WAITOK);
        respab = malloc(sizeof(struct ieee1394_abuf), M_1394DATA, M_WAITOK);
        statab = malloc(sizeof(struct ieee1394_abuf), M_1394DATA, M_WAITOK);
+       memset(respab, 0, sizeof(struct ieee1394_abuf));
+       memset(statab, 0, sizeof(struct ieee1394_abuf));
        
        statab->ab_length = 32;
        statab->ab_tcode = IEEE1394_TCODE_WRITE_REQ_BLOCK;



Home | Main Index | Thread Index | Old Index