From 648bbec934ad416e79a52f8de9c56abf0e6ccfb4 Mon Sep 17 00:00:00 2001 From: mrg Date: Sat, 21 Oct 2006 05:54:31 +0000 Subject: [PATCH] in cpu_dumpconf(), don't panic() if we can't bdevsw_lookup() the dumpdev. this occurs when we try to set the dumpdev to a device with no driver loaded. this fixes PR#34872. in sys_swapctl, if bdevsw_lookup() fails, set dumpdev = NODEV before calling cpu_dumpconf(). (this also fixes PR#34872.) XXX: cpu_dumpconf() should probably be changed to take a dumpdev XXX: and return an error in such cases, but that is a much more XXX: intrusive change. XXX2: this is only run-tested on sparc64 and compile tested on a XXX2: couple of platforms. --- sys/arch/alpha/alpha/machdep.c | 10 ++++++---- sys/arch/amd64/amd64/machdep.c | 10 ++++++---- sys/arch/amiga/amiga/machdep.c | 11 +++++++---- sys/arch/arm/arm32/stubs.c | 10 ++++++---- sys/arch/atari/atari/machdep.c | 10 +++++++--- sys/arch/cesfic/cesfic/machdep.c | 10 ++++++---- sys/arch/hp300/hp300/machdep.c | 10 ++++++---- sys/arch/hp700/hp700/autoconf.c | 10 ++++++---- sys/arch/i386/i386/machdep.c | 10 ++++++---- sys/arch/luna68k/luna68k/machdep.c | 10 ++++++---- sys/arch/mac68k/mac68k/machdep.c | 10 ++++++---- sys/arch/mips/mips/mips_machdep.c | 10 ++++++---- sys/arch/mvme68k/mvme68k/machdep.c | 10 ++++++---- sys/arch/news68k/news68k/machdep.c | 10 ++++++---- sys/arch/next68k/next68k/machdep.c | 10 ++++++---- sys/arch/pc532/pc532/machdep.c | 10 ++++++---- sys/arch/powerpc/powerpc/powerpc_machdep.c | 10 ++++++---- sys/arch/sun2/sun2/machdep.c | 10 ++++++---- sys/arch/sun3/sun3/machdep.c | 10 ++++++---- sys/arch/sun3/sun3x/machdep.c | 10 ++++++---- sys/arch/x68k/x68k/machdep.c | 10 ++++++---- sys/arch/xen/i386/machdep.c | 10 ++++++---- sys/uvm/uvm_swap.c | 9 ++++++--- 23 files changed, 140 insertions(+), 90 deletions(-) diff --git a/sys/arch/alpha/alpha/machdep.c b/sys/arch/alpha/alpha/machdep.c index 96fc6af5b909..eccc8b403d5e 100644 --- a/sys/arch/alpha/alpha/machdep.c +++ b/sys/arch/alpha/alpha/machdep.c @@ -1,4 +1,4 @@ -/* $NetBSD: machdep.c,v 1.288 2005/12/11 12:16:10 christos Exp $ */ +/* $NetBSD: machdep.c,v 1.289 2006/10/21 05:54:31 mrg Exp $ */ /*- * Copyright (c) 1998, 1999, 2000 The NetBSD Foundation, Inc. @@ -75,7 +75,7 @@ #include /* RCS ID & Copyright macro defns */ -__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.288 2005/12/11 12:16:10 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.289 2006/10/21 05:54:31 mrg Exp $"); #include #include @@ -1177,8 +1177,10 @@ cpu_dumpconf() if (dumpdev == NODEV) goto bad; bdev = bdevsw_lookup(dumpdev); - if (bdev == NULL) - panic("dumpconf: bad dumpdev=0x%x", dumpdev); + if (bdev == NULL) { + dumpdev = NODEV; + goto bad; + } if (bdev->d_psize == NULL) goto bad; nblks = (*bdev->d_psize)(dumpdev); diff --git a/sys/arch/amd64/amd64/machdep.c b/sys/arch/amd64/amd64/machdep.c index f7183da8924d..21bd4504eba9 100644 --- a/sys/arch/amd64/amd64/machdep.c +++ b/sys/arch/amd64/amd64/machdep.c @@ -1,4 +1,4 @@ -/* $NetBSD: machdep.c,v 1.42 2006/10/05 15:10:31 chs Exp $ */ +/* $NetBSD: machdep.c,v 1.43 2006/10/21 05:54:31 mrg Exp $ */ /*- * Copyright (c) 1996, 1997, 1998, 2000 The NetBSD Foundation, Inc. @@ -72,7 +72,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.42 2006/10/05 15:10:31 chs Exp $"); +__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.43 2006/10/21 05:54:31 mrg Exp $"); #include "opt_user_ldt.h" #include "opt_ddb.h" @@ -710,8 +710,10 @@ cpu_dumpconf(void) if (dumpdev == NODEV) goto bad; bdev = bdevsw_lookup(dumpdev); - if (bdev == NULL) - panic("dumpconf: bad dumpdev=0x%x", dumpdev); + if (bdev == NULL) { + dumpdev = NODEV; + goto bad; + } if (bdev->d_psize == NULL) goto bad; nblks = (*bdev->d_psize)(dumpdev); diff --git a/sys/arch/amiga/amiga/machdep.c b/sys/arch/amiga/amiga/machdep.c index c99936f1c27a..bede6f6ee57b 100644 --- a/sys/arch/amiga/amiga/machdep.c +++ b/sys/arch/amiga/amiga/machdep.c @@ -1,4 +1,4 @@ -/* $NetBSD: machdep.c,v 1.196 2006/06/09 21:29:39 aymeric Exp $ */ +/* $NetBSD: machdep.c,v 1.197 2006/10/21 05:54:31 mrg Exp $ */ /* * Copyright (c) 1982, 1986, 1990 The Regents of the University of California. @@ -85,7 +85,7 @@ #include "opt_panicbutton.h" #include -__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.196 2006/06/09 21:29:39 aymeric Exp $"); +__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.197 2006/10/21 05:54:31 mrg Exp $"); #include #include @@ -620,8 +620,11 @@ cpu_dumpconf() m->ram_segs[1].size = memlist->m_seg[i].ms_size; break; } - if ((bdev = bdevsw_lookup(dumpdev)) != NULL && - bdev->d_psize != NULL) { + if ((bdev = bdevsw_lookup(dumpdev) == NULL) { + dumpdev = NODEV; + return; + } + if (bdev->d_psize != NULL) { nblks = (*bdev->d_psize)(dumpdev); if (dumpsize > btoc(dbtob(nblks - dumplo))) dumpsize = btoc(dbtob(nblks - dumplo)); diff --git a/sys/arch/arm/arm32/stubs.c b/sys/arch/arm/arm32/stubs.c index 62e8a09a23f9..e5418efb195d 100644 --- a/sys/arch/arm/arm32/stubs.c +++ b/sys/arch/arm/arm32/stubs.c @@ -1,4 +1,4 @@ -/* $NetBSD: stubs.c,v 1.15 2005/12/11 12:16:41 christos Exp $ */ +/* $NetBSD: stubs.c,v 1.16 2006/10/21 05:54:31 mrg Exp $ */ /* * Copyright (c) 1994-1998 Mark Brinicombe. @@ -41,7 +41,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: stubs.c,v 1.15 2005/12/11 12:16:41 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: stubs.c,v 1.16 2006/10/21 05:54:31 mrg Exp $"); #include #include @@ -84,8 +84,10 @@ cpu_dumpconf() if (dumpdev == NODEV) return; bdev = bdevsw_lookup(dumpdev); - if (bdev == NULL) - panic("dumpconf: bad dumpdev=0x%x", dumpdev); + if (bdev == NULL) { + dumpdev = NODEV; + return; + } if (bdev->d_psize == NULL) return; nblks = (*bdev->d_psize)(dumpdev); diff --git a/sys/arch/atari/atari/machdep.c b/sys/arch/atari/atari/machdep.c index b7f137178c24..5827ec4109b1 100644 --- a/sys/arch/atari/atari/machdep.c +++ b/sys/arch/atari/atari/machdep.c @@ -1,4 +1,4 @@ -/* $NetBSD: machdep.c,v 1.139 2005/12/24 22:45:34 perry Exp $ */ +/* $NetBSD: machdep.c,v 1.140 2006/10/21 05:54:31 mrg Exp $ */ /* * Copyright (c) 1982, 1986, 1990 The Regents of the University of California. @@ -77,7 +77,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.139 2005/12/24 22:45:34 perry Exp $"); +__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.140 2006/10/21 05:54:31 mrg Exp $"); #include "opt_ddb.h" #include "opt_compat_netbsd.h" @@ -492,7 +492,11 @@ cpu_dumpconf() if (dumpdev != NODEV) { bdev = bdevsw_lookup(dumpdev); - if (bdev != NULL && bdev->d_psize != NULL) { + if (bdev == NULL) { + dumpdev = NODEV; + return; + } + if (bdev->d_psize != NULL) { nblks = (*bdev->d_psize)(dumpdev); if (dumpsize > btoc(dbtob(nblks - dumplo))) dumpsize = btoc(dbtob(nblks - dumplo)); diff --git a/sys/arch/cesfic/cesfic/machdep.c b/sys/arch/cesfic/cesfic/machdep.c index 43167b236dc1..0ecfe0a75be8 100644 --- a/sys/arch/cesfic/cesfic/machdep.c +++ b/sys/arch/cesfic/cesfic/machdep.c @@ -1,4 +1,4 @@ -/* $NetBSD: machdep.c,v 1.32 2005/12/27 07:25:57 yamt Exp $ */ +/* $NetBSD: machdep.c,v 1.33 2006/10/21 05:54:31 mrg Exp $ */ /* * Copyright (c) 1982, 1986, 1990, 1993 @@ -77,7 +77,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.32 2005/12/27 07:25:57 yamt Exp $"); +__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.33 2006/10/21 05:54:31 mrg Exp $"); #include "opt_bufcache.h" #include "opt_ddb.h" @@ -493,8 +493,10 @@ cpu_dumpconf() if (dumpdev == NODEV) return; bdev = bdevsw_lookup(dumpdev); - if (bdev == NULL) - panic("dumpconf: bad dumpdev=0x%x", dumpdev); + if (bdev == NULL) { + dumpdev = NODEV; + return; + } if (bdev->d_psize == NULL) return; nblks = (*bdev->d_psize)(dumpdev); diff --git a/sys/arch/hp300/hp300/machdep.c b/sys/arch/hp300/hp300/machdep.c index abd68f5bddf8..bb8c03b1e560 100644 --- a/sys/arch/hp300/hp300/machdep.c +++ b/sys/arch/hp300/hp300/machdep.c @@ -1,4 +1,4 @@ -/* $NetBSD: machdep.c,v 1.188 2006/07/21 10:01:40 tsutsui Exp $ */ +/* $NetBSD: machdep.c,v 1.189 2006/10/21 05:54:31 mrg Exp $ */ /* * Copyright (c) 1982, 1986, 1990, 1993 @@ -77,7 +77,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.188 2006/07/21 10:01:40 tsutsui Exp $"); +__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.189 2006/10/21 05:54:31 mrg Exp $"); #include "opt_ddb.h" #include "opt_compat_hpux.h" @@ -828,8 +828,10 @@ cpu_dumpconf(void) if (dumpdev == NODEV) return; bdev = bdevsw_lookup(dumpdev); - if (bdev == NULL) - panic("dumpconf: bad dumpdev=0x%x", dumpdev); + if (bdev == NULL) { + dumpdev = NODEV; + return; + } if (bdev->d_psize == NULL) return; nblks = (*bdev->d_psize)(dumpdev); diff --git a/sys/arch/hp700/hp700/autoconf.c b/sys/arch/hp700/hp700/autoconf.c index dd71e0b3d99c..1ec1af35eafb 100644 --- a/sys/arch/hp700/hp700/autoconf.c +++ b/sys/arch/hp700/hp700/autoconf.c @@ -1,4 +1,4 @@ -/* $NetBSD: autoconf.c,v 1.22 2006/02/26 05:31:54 thorpej Exp $ */ +/* $NetBSD: autoconf.c,v 1.23 2006/10/21 05:54:32 mrg Exp $ */ /* $OpenBSD: autoconf.c,v 1.15 2001/06/25 00:43:10 mickey Exp $ */ @@ -86,7 +86,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.22 2006/02/26 05:31:54 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.23 2006/10/21 05:54:32 mrg Exp $"); #include "opt_kgdb.h" #include "opt_useleds.h" @@ -280,8 +280,10 @@ cpu_dumpconf(void) if (dumpdev == NODEV) goto bad; bdev = bdevsw_lookup(dumpdev); - if (bdev == NULL) - panic("dumpconf: bad dumpdev=0x%x", dumpdev); + if (bdev == NULL) { + dumpdev = NODEV; + goto bad; + } if (bdev->d_psize == NULL) goto bad; nblks = (*bdev->d_psize)(dumpdev); diff --git a/sys/arch/i386/i386/machdep.c b/sys/arch/i386/i386/machdep.c index 755df0298271..b96cff498d38 100644 --- a/sys/arch/i386/i386/machdep.c +++ b/sys/arch/i386/i386/machdep.c @@ -1,4 +1,4 @@ -/* $NetBSD: machdep.c,v 1.581 2006/10/12 04:31:54 thorpej Exp $ */ +/* $NetBSD: machdep.c,v 1.582 2006/10/21 05:54:32 mrg Exp $ */ /*- * Copyright (c) 1996, 1997, 1998, 2000, 2004, 2006 The NetBSD Foundation, Inc. @@ -72,7 +72,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.581 2006/10/12 04:31:54 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.582 2006/10/21 05:54:32 mrg Exp $"); #include "opt_beep.h" #include "opt_compat_ibcs2.h" @@ -1036,8 +1036,10 @@ cpu_dumpconf() if (dumpdev == NODEV) goto bad; bdev = bdevsw_lookup(dumpdev); - if (bdev == NULL) - panic("dumpconf: bad dumpdev=0x%x", dumpdev); + if (bdev == NULL) { + dumpdev = NODEV; + goto out; + } if (bdev->d_psize == NULL) goto bad; nblks = (*bdev->d_psize)(dumpdev); diff --git a/sys/arch/luna68k/luna68k/machdep.c b/sys/arch/luna68k/luna68k/machdep.c index 67469e6f23e1..3184b273f1cd 100644 --- a/sys/arch/luna68k/luna68k/machdep.c +++ b/sys/arch/luna68k/luna68k/machdep.c @@ -1,4 +1,4 @@ -/* $NetBSD: machdep.c,v 1.46 2006/09/14 15:04:07 gdamore Exp $ */ +/* $NetBSD: machdep.c,v 1.47 2006/10/21 05:54:32 mrg Exp $ */ /*- * Copyright (c) 2000 The NetBSD Foundation, Inc. @@ -38,7 +38,7 @@ #include /* RCS ID & Copyright macro defns */ -__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.46 2006/09/14 15:04:07 gdamore Exp $"); +__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.47 2006/10/21 05:54:32 mrg Exp $"); #include "opt_ddb.h" #include "opt_kgdb.h" @@ -572,8 +572,10 @@ cpu_dumpconf() if (dumpdev == NODEV) return; bdev = bdevsw_lookup(dumpdev); - if (bdev == NULL) - panic("dumpconf: bad dumpdev=0x%x", dumpdev); + if (bdev == NULL) { + dumpdev = NODEV; + return; + } if (bdev->d_psize == NULL) return; nblks = (*bdev->d_psize)(dumpdev); diff --git a/sys/arch/mac68k/mac68k/machdep.c b/sys/arch/mac68k/mac68k/machdep.c index 523d9cc6df3c..279cc1404465 100644 --- a/sys/arch/mac68k/mac68k/machdep.c +++ b/sys/arch/mac68k/mac68k/machdep.c @@ -1,4 +1,4 @@ -/* $NetBSD: machdep.c,v 1.308 2005/12/24 20:07:15 perry Exp $ */ +/* $NetBSD: machdep.c,v 1.309 2006/10/21 05:54:32 mrg Exp $ */ /* * Copyright (c) 1982, 1990 The Regents of the University of California. @@ -107,7 +107,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.308 2005/12/24 20:07:15 perry Exp $"); +__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.309 2006/10/21 05:54:32 mrg Exp $"); #include "opt_adb.h" #include "opt_ddb.h" @@ -745,8 +745,10 @@ cpu_dumpconf(void) return; bdev = bdevsw_lookup(dumpdev); - if (bdev == NULL) - panic("dumpconf: bad dumpdev=0x%x", dumpdev); + if (bdev == NULL) { + dumpdev = NODEV; + return; + } if (bdev->d_psize == NULL) return; nblks = (*bdev->d_psize)(dumpdev); diff --git a/sys/arch/mips/mips/mips_machdep.c b/sys/arch/mips/mips/mips_machdep.c index 2568300337f5..e1a2f1b9361b 100644 --- a/sys/arch/mips/mips/mips_machdep.c +++ b/sys/arch/mips/mips/mips_machdep.c @@ -1,4 +1,4 @@ -/* $NetBSD: mips_machdep.c,v 1.187 2006/08/26 20:18:36 matt Exp $ */ +/* $NetBSD: mips_machdep.c,v 1.188 2006/10/21 05:54:32 mrg Exp $ */ /* * Copyright 2002 Wasabi Systems, Inc. @@ -119,7 +119,7 @@ #include /* RCS ID & Copyright macro defns */ -__KERNEL_RCSID(0, "$NetBSD: mips_machdep.c,v 1.187 2006/08/26 20:18:36 matt Exp $"); +__KERNEL_RCSID(0, "$NetBSD: mips_machdep.c,v 1.188 2006/10/21 05:54:32 mrg Exp $"); #include "opt_cputype.h" @@ -1317,8 +1317,10 @@ cpu_dumpconf(void) if (dumpdev == NODEV) goto bad; bdev = bdevsw_lookup(dumpdev); - if (bdev == NULL) - panic("dumpconf: bad dumpdev=0x%x", dumpdev); + if (bdev == NULL) { + dumpdev = NODEV; + return; + } if (bdev->d_psize == NULL) goto bad; nblks = (*bdev->d_psize)(dumpdev); diff --git a/sys/arch/mvme68k/mvme68k/machdep.c b/sys/arch/mvme68k/mvme68k/machdep.c index 08a00391c8cf..ef0713d2f4b1 100644 --- a/sys/arch/mvme68k/mvme68k/machdep.c +++ b/sys/arch/mvme68k/mvme68k/machdep.c @@ -1,4 +1,4 @@ -/* $NetBSD: machdep.c,v 1.115 2006/08/04 01:58:49 mhitch Exp $ */ +/* $NetBSD: machdep.c,v 1.116 2006/10/21 05:54:32 mrg Exp $ */ /* * Copyright (c) 1982, 1986, 1990, 1993 @@ -77,7 +77,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.115 2006/08/04 01:58:49 mhitch Exp $"); +__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.116 2006/10/21 05:54:32 mrg Exp $"); #include "opt_ddb.h" #include "opt_compat_hpux.h" @@ -933,8 +933,10 @@ cpu_dumpconf() if (dumpdev == NODEV) goto bad; bdev = bdevsw_lookup(dumpdev); - if (bdev == NULL) - panic("dumpconf: bad dumpdev=0x%x", dumpdev); + if (bdev == NULL) { + dumpdev = NODEV; + goto bad; + } if (bdev->d_psize == NULL) goto bad; nblks = (*bdev->d_psize)(dumpdev); diff --git a/sys/arch/news68k/news68k/machdep.c b/sys/arch/news68k/news68k/machdep.c index ad355bcd0017..45faf8ed9c52 100644 --- a/sys/arch/news68k/news68k/machdep.c +++ b/sys/arch/news68k/news68k/machdep.c @@ -1,4 +1,4 @@ -/* $NetBSD: machdep.c,v 1.62 2005/12/11 12:18:23 christos Exp $ */ +/* $NetBSD: machdep.c,v 1.63 2006/10/21 05:54:32 mrg Exp $ */ /* * Copyright (c) 1982, 1986, 1990, 1993 @@ -77,7 +77,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.62 2005/12/11 12:18:23 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.63 2006/10/21 05:54:32 mrg Exp $"); #include "opt_ddb.h" #include "opt_compat_netbsd.h" @@ -562,8 +562,10 @@ cpu_dumpconf(void) if (dumpdev == NODEV) return; bdev = bdevsw_lookup(dumpdev); - if (bdev == NULL) - panic("dumpconf: bad dumpdev=0x%x", dumpdev); + if (bdev == NULL) { + dumpdev = NODEV; + return; + } if (bdev->d_psize == NULL) return; nblks = (*bdev->d_psize)(dumpdev); diff --git a/sys/arch/next68k/next68k/machdep.c b/sys/arch/next68k/next68k/machdep.c index 7ed14b52441a..95c0b89fb1a6 100644 --- a/sys/arch/next68k/next68k/machdep.c +++ b/sys/arch/next68k/next68k/machdep.c @@ -1,4 +1,4 @@ -/* $NetBSD: machdep.c,v 1.74 2005/12/11 12:18:29 christos Exp $ */ +/* $NetBSD: machdep.c,v 1.75 2006/10/21 05:54:32 mrg Exp $ */ /* * Copyright (c) 1998 Darrin B. Jewell @@ -79,7 +79,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.74 2005/12/11 12:18:29 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.75 2006/10/21 05:54:32 mrg Exp $"); #include "opt_ddb.h" #include "opt_kgdb.h" @@ -722,8 +722,10 @@ cpu_dumpconf(void) if (dumpdev == NODEV) return; bdev = bdevsw_lookup(dumpdev); - if (bdev == NULL) - panic("dumpconf: bad dumpdev=0x%x", dumpdev); + if (bdev == NULL) { + dumpdev = NODEV; + return; + } if (bdev->d_psize == NULL) return; nblks = (*bdev->d_psize)(dumpdev); diff --git a/sys/arch/pc532/pc532/machdep.c b/sys/arch/pc532/pc532/machdep.c index 1f406d6424e5..c6e05db20143 100644 --- a/sys/arch/pc532/pc532/machdep.c +++ b/sys/arch/pc532/pc532/machdep.c @@ -1,4 +1,4 @@ -/* $NetBSD: machdep.c,v 1.164 2006/05/12 06:05:23 simonb Exp $ */ +/* $NetBSD: machdep.c,v 1.165 2006/10/21 05:54:32 mrg Exp $ */ /*- * Copyright (c) 1982, 1987, 1990 The Regents of the University of California. @@ -75,7 +75,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.164 2006/05/12 06:05:23 simonb Exp $"); +__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.165 2006/10/21 05:54:32 mrg Exp $"); #include "opt_ddb.h" #include "opt_kgdb.h" @@ -625,8 +625,10 @@ cpu_dumpconf(void) if (dumpdev == NODEV) return; bdev = bdevsw_lookup(dumpdev); - if (bdev == NULL) - panic("dumpconf: bad dumpdev=0x%x", dumpdev); + if (bdev == NULL) { + dumpdev = NODEV; + return; + } if (bdev->d_psize == NULL) goto bad; nblks = (*bdev->d_psize)(dumpdev); diff --git a/sys/arch/powerpc/powerpc/powerpc_machdep.c b/sys/arch/powerpc/powerpc/powerpc_machdep.c index afade6449b87..86cba6dbc560 100644 --- a/sys/arch/powerpc/powerpc/powerpc_machdep.c +++ b/sys/arch/powerpc/powerpc/powerpc_machdep.c @@ -1,4 +1,4 @@ -/* $NetBSD: powerpc_machdep.c,v 1.31 2006/08/05 21:26:49 sanjayl Exp $ */ +/* $NetBSD: powerpc_machdep.c,v 1.32 2006/10/21 05:54:32 mrg Exp $ */ /* * Copyright (C) 1995, 1996 Wolfgang Solfrank. @@ -32,7 +32,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: powerpc_machdep.c,v 1.31 2006/08/05 21:26:49 sanjayl Exp $"); +__KERNEL_RCSID(0, "$NetBSD: powerpc_machdep.c,v 1.32 2006/10/21 05:54:32 mrg Exp $"); #include "opt_altivec.h" @@ -204,8 +204,10 @@ cpu_dumpconf(void) if (dumpdev == NODEV) return; bdev = bdevsw_lookup(dumpdev); - if (bdev == NULL) - panic("dumpconf: bad dumpdev=0x%x", dumpdev); + if (bdev == NULL) { + dumpdev = NODEV; + return; + } if (bdev->d_psize == NULL) return; nblks = (*bdev->d_psize)(dumpdev); diff --git a/sys/arch/sun2/sun2/machdep.c b/sys/arch/sun2/sun2/machdep.c index 7d238c6ee50c..c2e431e3ef9d 100644 --- a/sys/arch/sun2/sun2/machdep.c +++ b/sys/arch/sun2/sun2/machdep.c @@ -1,4 +1,4 @@ -/* $NetBSD: machdep.c,v 1.43 2006/10/03 13:02:32 tsutsui Exp $ */ +/* $NetBSD: machdep.c,v 1.44 2006/10/21 05:54:33 mrg Exp $ */ /* * Copyright (c) 1982, 1986, 1990, 1993 @@ -160,7 +160,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.43 2006/10/03 13:02:32 tsutsui Exp $"); +__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.44 2006/10/21 05:54:33 mrg Exp $"); #include "opt_ddb.h" #include "opt_kgdb.h" @@ -630,8 +630,10 @@ cpu_dumpconf(void) return; bdev = bdevsw_lookup(dumpdev); - if (bdev == NULL) - panic("dumpconf: bad dumpdev=0x%x", dumpdev); + if (bdev == NULL) { + dumpdev = NODEV; + return; + } getsize = bdev->d_psize; if (getsize == NULL) return; diff --git a/sys/arch/sun3/sun3/machdep.c b/sys/arch/sun3/sun3/machdep.c index b36f688479dc..64477b2d3dd2 100644 --- a/sys/arch/sun3/sun3/machdep.c +++ b/sys/arch/sun3/sun3/machdep.c @@ -1,4 +1,4 @@ -/* $NetBSD: machdep.c,v 1.177 2006/10/05 14:46:11 tsutsui Exp $ */ +/* $NetBSD: machdep.c,v 1.178 2006/10/21 05:54:33 mrg Exp $ */ /* * Copyright (c) 1982, 1986, 1990, 1993 @@ -78,7 +78,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.177 2006/10/05 14:46:11 tsutsui Exp $"); +__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.178 2006/10/21 05:54:33 mrg Exp $"); #include "opt_ddb.h" #include "opt_kgdb.h" @@ -535,8 +535,10 @@ cpu_dumpconf(void) return; bdev = bdevsw_lookup(dumpdev); - if (bdev == NULL) - panic("dumpconf: bad dumpdev=0x%x", dumpdev); + if (bdev == NULL) { + dumpdev = NODEV; + return; + } getsize = bdev->d_psize; if (getsize == NULL) return; diff --git a/sys/arch/sun3/sun3x/machdep.c b/sys/arch/sun3/sun3x/machdep.c index 9e01e0029801..bb1879a46d6b 100644 --- a/sys/arch/sun3/sun3x/machdep.c +++ b/sys/arch/sun3/sun3x/machdep.c @@ -1,4 +1,4 @@ -/* $NetBSD: machdep.c,v 1.103 2006/10/05 14:46:12 tsutsui Exp $ */ +/* $NetBSD: machdep.c,v 1.104 2006/10/21 05:54:33 mrg Exp $ */ /* * Copyright (c) 1982, 1986, 1990, 1993 @@ -75,7 +75,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.103 2006/10/05 14:46:12 tsutsui Exp $"); +__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.104 2006/10/21 05:54:33 mrg Exp $"); #include "opt_ddb.h" #include "opt_kgdb.h" @@ -562,8 +562,10 @@ cpu_dumpconf(void) return; bdev = bdevsw_lookup(dumpdev); - if (bdev == NULL) - panic("dumpconf: bad dumpdev=0x%x", dumpdev); + if (bdev == NULL) { + dumpdev = NODEV; + return; + } getsize = bdev->d_psize; if (getsize == NULL) return; diff --git a/sys/arch/x68k/x68k/machdep.c b/sys/arch/x68k/x68k/machdep.c index dd065b3a5c54..4ecfb938ab42 100644 --- a/sys/arch/x68k/x68k/machdep.c +++ b/sys/arch/x68k/x68k/machdep.c @@ -1,4 +1,4 @@ -/* $NetBSD: machdep.c,v 1.132 2006/08/04 02:17:34 mhitch Exp $ */ +/* $NetBSD: machdep.c,v 1.133 2006/10/21 05:54:33 mrg Exp $ */ /* * Copyright (c) 1982, 1986, 1990, 1993 @@ -77,7 +77,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.132 2006/08/04 02:17:34 mhitch Exp $"); +__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.133 2006/10/21 05:54:33 mrg Exp $"); #include "opt_ddb.h" #include "opt_kgdb.h" @@ -670,8 +670,10 @@ cpu_dumpconf(void) if (dumpdev == NODEV) return; bdev = bdevsw_lookup(dumpdev); - if (bdev == NULL) - panic("dumpconf: bad dumpdev=0x%x", dumpdev); + if (bdev == NULL) { + dumpdev = NODEV; + return; + } if (bdev->d_psize == NULL) return; nblks = (*bdev->d_psize)(dumpdev); diff --git a/sys/arch/xen/i386/machdep.c b/sys/arch/xen/i386/machdep.c index b99e4d490f4c..915cb0287b26 100644 --- a/sys/arch/xen/i386/machdep.c +++ b/sys/arch/xen/i386/machdep.c @@ -1,4 +1,4 @@ -/* $NetBSD: machdep.c,v 1.28 2006/05/22 13:44:53 yamt Exp $ */ +/* $NetBSD: machdep.c,v 1.29 2006/10/21 05:54:33 mrg Exp $ */ /* NetBSD: machdep.c,v 1.559 2004/07/22 15:12:46 mycroft Exp */ /*- @@ -73,7 +73,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.28 2006/05/22 13:44:53 yamt Exp $"); +__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.29 2006/10/21 05:54:33 mrg Exp $"); #include "opt_beep.h" #include "opt_compat_ibcs2.h" @@ -984,8 +984,10 @@ cpu_dumpconf() if (dumpdev == NODEV) goto bad; bdev = bdevsw_lookup(dumpdev); - if (bdev == NULL) - panic("dumpconf: bad dumpdev=0x%x", dumpdev); + if (bdev == NULL) { + dumpdev = NODEV; + return; + } if (bdev->d_psize == NULL) goto bad; nblks = (*bdev->d_psize)(dumpdev); diff --git a/sys/uvm/uvm_swap.c b/sys/uvm/uvm_swap.c index 3662c1be7438..77bdb4f4a960 100644 --- a/sys/uvm/uvm_swap.c +++ b/sys/uvm/uvm_swap.c @@ -1,4 +1,4 @@ -/* $NetBSD: uvm_swap.c,v 1.108 2006/10/12 04:35:40 thorpej Exp $ */ +/* $NetBSD: uvm_swap.c,v 1.109 2006/10/21 05:54:34 mrg Exp $ */ /* * Copyright (c) 1995, 1996, 1997 Matthew R. Green @@ -32,7 +32,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: uvm_swap.c,v 1.108 2006/10/12 04:35:40 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: uvm_swap.c,v 1.109 2006/10/21 05:54:34 mrg Exp $"); #include "fs_nfs.h" #include "opt_uvmhist.h" @@ -565,7 +565,10 @@ sys_swapctl(struct lwp *l, void *v, register_t *retval) error = ENOTBLK; break; } - dumpdev = vp->v_rdev; + if (bdevsw_lookup(vp->v_rdev)) + dumpdev = vp->v_rdev; + else + dumpdev = NODEV; cpu_dumpconf(); break;