From a4fcac54a171f9b11bd2ba6d4ca64834b32e2bff Mon Sep 17 00:00:00 2001 From: Bruce Evans Date: Thu, 9 Mar 2000 12:40:41 +0000 Subject: [PATCH] Fixed a null pointer panic for dumpon(8) on a nonexistent device whose driver uses the new disk layer. Reviewed by: phk Approved by: jkh --- sys/kern/subr_disk.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sys/kern/subr_disk.c b/sys/kern/subr_disk.c index cf1b3ccab8cf..23ec0034988d 100644 --- a/sys/kern/subr_disk.c +++ b/sys/kern/subr_disk.c @@ -229,6 +229,8 @@ diskpsize(dev_t dev) if (!dp) { pdev = dkmodpart(dkmodslice(dev, WHOLE_DISK_SLICE), RAW_PART); dp = pdev->si_disk; + if (!dp) + return (-1); dev->si_drv1 = pdev->si_drv1; dev->si_drv2 = pdev->si_drv2; /* XXX: don't set bp->b_dev->si_disk (?) */