Source-Changes-HG archive

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

[src/trunk]: src/sys/kern Use KASSERT to ensure that the newly-added module's...



details:   https://anonhg.NetBSD.org/src/rev/1c67af67e5ae
branches:  trunk
changeset: 358103:1c67af67e5ae
user:      pgoyette <pgoyette%NetBSD.org@localhost>
date:      Mon Dec 11 22:00:26 2017 +0000

description:
Use KASSERT to ensure that the newly-added module's name can be found.

XXX Pull-up to -8

diffstat:

 sys/kern/kern_module.c |  7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diffs (28 lines):

diff -r 01e4c18b0db5 -r 1c67af67e5ae sys/kern/kern_module.c
--- a/sys/kern/kern_module.c    Mon Dec 11 13:08:47 2017 +0000
+++ b/sys/kern/kern_module.c    Mon Dec 11 22:00:26 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kern_module.c,v 1.126 2017/12/10 03:08:32 pgoyette Exp $       */
+/*     $NetBSD: kern_module.c,v 1.127 2017/12/11 22:00:26 pgoyette Exp $       */
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_module.c,v 1.126 2017/12/10 03:08:32 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_module.c,v 1.127 2017/12/11 22:00:26 pgoyette Exp $");
 
 #define _MODULE_INTERNAL
 
@@ -1047,7 +1047,8 @@
         */
        if (mod->mod_source == MODULE_SOURCE_FILESYS) {
                mod2 = module_lookup(mod->mod_info->mi_name);
-               if (mod2 && mod2 != mod) {
+               KASSERTMSG(mod2, "Newly added module not found!");
+               if (mod2 != mod) {
                        module_error("module with name `%s' already loaded",
                            mod2->mod_info->mi_name);
                        error = EEXIST;



Home | Main Index | Thread Index | Old Index