Source-Changes-HG archive

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

[src/trunk]: src/external/cddl/osnet Remove a couple of zero length kmem_frees.



details:   https://anonhg.NetBSD.org/src/rev/7c84513c4bdc
branches:  trunk
changeset: 754192:7c84513c4bdc
user:      ahoka <ahoka%NetBSD.org@localhost>
date:      Fri Apr 23 11:39:52 2010 +0000

description:
Remove a couple of zero length kmem_frees.

It should fix at least one crash when unloading the dtrace module,
possibly many others.

diffstat:

 external/cddl/osnet/dev/dtrace/amd64/dtrace_subr.c  |  4 ++--
 external/cddl/osnet/dev/dtrace/dtrace_sysctl.c      |  4 ++--
 external/cddl/osnet/dev/dtrace/dtrace_unload.c      |  4 ++--
 external/cddl/osnet/dev/dtrace/i386/dtrace_subr.c   |  4 ++--
 external/cddl/osnet/dist/uts/common/dtrace/dtrace.c |  6 +++---
 5 files changed, 11 insertions(+), 11 deletions(-)

diffs (98 lines):

diff -r 728bd7719cee -r 7c84513c4bdc external/cddl/osnet/dev/dtrace/amd64/dtrace_subr.c
--- a/external/cddl/osnet/dev/dtrace/amd64/dtrace_subr.c        Fri Apr 23 11:00:27 2010 +0000
+++ b/external/cddl/osnet/dev/dtrace/amd64/dtrace_subr.c        Fri Apr 23 11:39:52 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: dtrace_subr.c,v 1.3 2010/03/13 22:31:15 christos Exp $ */
+/*     $NetBSD: dtrace_subr.c,v 1.4 2010/04/23 11:39:53 ahoka Exp $    */
 
 /*
  * CDDL HEADER START
@@ -110,7 +110,7 @@
                prev->dtih_next = hdlr->dtih_next;
        }
 
-       kmem_free(hdlr, 0);
+       kmem_free(hdlr, sizeof (dtrace_invop_hdlr_t));
 }
 
 /*ARGSUSED*/
diff -r 728bd7719cee -r 7c84513c4bdc external/cddl/osnet/dev/dtrace/dtrace_sysctl.c
--- a/external/cddl/osnet/dev/dtrace/dtrace_sysctl.c    Fri Apr 23 11:00:27 2010 +0000
+++ b/external/cddl/osnet/dev/dtrace/dtrace_sysctl.c    Fri Apr 23 11:39:52 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: dtrace_sysctl.c,v 1.2 2010/02/21 01:46:33 darran Exp $ */
+/*     $NetBSD: dtrace_sysctl.c,v 1.3 2010/04/23 11:39:52 ahoka Exp $  */
 
 /*
  * CDDL HEADER START
@@ -76,7 +76,7 @@
        if (p_name != NULL) {
                error = sysctl_handle_string(oidp, p_name, len, req);
 
-               kmem_free(p_name, 0);
+               kmem_free(p_name, len);
        }
 
        return (error);
diff -r 728bd7719cee -r 7c84513c4bdc external/cddl/osnet/dev/dtrace/dtrace_unload.c
--- a/external/cddl/osnet/dev/dtrace/dtrace_unload.c    Fri Apr 23 11:00:27 2010 +0000
+++ b/external/cddl/osnet/dev/dtrace/dtrace_unload.c    Fri Apr 23 11:39:52 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: dtrace_unload.c,v 1.2 2010/02/21 01:46:33 darran Exp $ */
+/*     $NetBSD: dtrace_unload.c,v 1.3 2010/04/23 11:39:52 ahoka Exp $  */
 
 /*
  * CDDL HEADER START
@@ -92,7 +92,7 @@
        vmem_destroy(dtrace_arena);
 
        if (dtrace_toxrange != NULL) {
-               kmem_free(dtrace_toxrange, 0);
+               kmem_free(dtrace_toxrange, sizeof (dtrace_toxrange_t *);
                dtrace_toxrange = NULL;
                dtrace_toxranges = 0;
                dtrace_toxranges_max = 0;
diff -r 728bd7719cee -r 7c84513c4bdc external/cddl/osnet/dev/dtrace/i386/dtrace_subr.c
--- a/external/cddl/osnet/dev/dtrace/i386/dtrace_subr.c Fri Apr 23 11:00:27 2010 +0000
+++ b/external/cddl/osnet/dev/dtrace/i386/dtrace_subr.c Fri Apr 23 11:39:52 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: dtrace_subr.c,v 1.4 2010/03/18 13:45:54 tron Exp $     */
+/*     $NetBSD: dtrace_subr.c,v 1.5 2010/04/23 11:39:53 ahoka Exp $    */
 
 /*
  * CDDL HEADER START
@@ -113,7 +113,7 @@
                prev->dtih_next = hdlr->dtih_next;
        }
 
-       kmem_free(hdlr, 0);
+       kmem_free(hdlr, sizeof (dtrace_invop_hdlr_t));
 }
 
 void
diff -r 728bd7719cee -r 7c84513c4bdc external/cddl/osnet/dist/uts/common/dtrace/dtrace.c
--- a/external/cddl/osnet/dist/uts/common/dtrace/dtrace.c       Fri Apr 23 11:00:27 2010 +0000
+++ b/external/cddl/osnet/dist/uts/common/dtrace/dtrace.c       Fri Apr 23 11:39:52 2010 +0000
@@ -11854,19 +11854,19 @@
        freeenv(p_env);
 
        if (len < sizeof (dof_hdr_t)) {
-               kmem_free(buf, 0);
+               kmem_free(buf, len);
                dtrace_dof_error(NULL, "truncated header");
                return (NULL);
        }
 
        if (len < (loadsz = dof->dofh_loadsz)) {
-               kmem_free(buf, 0);
+               kmem_free(buf, len);
                dtrace_dof_error(NULL, "truncated DOF");
                return (NULL);
        }
 
        if (loadsz >= dtrace_dof_maxsize) {
-               kmem_free(buf, 0);
+               kmem_free(buf, len);
                dtrace_dof_error(NULL, "oversized DOF");
                return (NULL);
        }



Home | Main Index | Thread Index | Old Index