Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/kern Replace unsafe use of TAILQ_FOREACH: as the comment...
details: https://anonhg.NetBSD.org/src/rev/d28b4d252234
branches: trunk
changeset: 752690:d28b4d252234
user: pooka <pooka%NetBSD.org@localhost>
date: Wed Mar 03 17:58:36 2010 +0000
description:
Replace unsafe use of TAILQ_FOREACH: as the comment says, the
structures are pulled off the list in the loop and it's anyone's
guess where they go after that.
diffstat:
sys/kern/kern_module.c | 9 +++++----
1 files changed, 5 insertions(+), 4 deletions(-)
diffs (37 lines):
diff -r 8287e07bcb70 -r d28b4d252234 sys/kern/kern_module.c
--- a/sys/kern/kern_module.c Wed Mar 03 17:37:01 2010 +0000
+++ b/sys/kern/kern_module.c Wed Mar 03 17:58:36 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: kern_module.c,v 1.57 2010/01/19 15:23:14 pooka Exp $ */
+/* $NetBSD: kern_module.c,v 1.58 2010/03/03 17:58:36 pooka 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.57 2010/01/19 15:23:14 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_module.c,v 1.58 2010/03/03 17:58:36 pooka Exp $");
#define _MODULE_INTERNAL
@@ -247,7 +247,7 @@
{
__link_set_decl(modules, modinfo_t);
modinfo_t *const *mip, *mi;
- module_t *mod;
+ module_t *mod, *mod_next;
mutex_enter(&module_lock);
/*
@@ -268,7 +268,8 @@
* list as we call module_do_load();
*/
do {
- TAILQ_FOREACH(mod, &module_bootlist, mod_chain) {
+ for (mod = TAILQ_FIRST(&module_bootlist); mod; mod = mod_next) {
+ mod_next = TAILQ_NEXT(mod, mod_chain);
mi = mod->mod_info;
if (class != MODULE_CLASS_ANY &&
class != mi->mi_class)
Home |
Main Index |
Thread Index |
Old Index