From 9a6caa1afca201d2bc7aedd35bc7bf69e8a73116 Mon Sep 17 00:00:00 2001 From: Colin Percival Date: Sun, 22 Feb 2004 10:00:05 +0000 Subject: [PATCH] Check that amrd_sc is non-NULL before dereferencing it, not after. Reported by: "Ted Unangst" Approved by: rwatson (mentor) --- sys/dev/amr/amr_disk.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/dev/amr/amr_disk.c b/sys/dev/amr/amr_disk.c index a93e1edd0f9e..fef49190f69a 100644 --- a/sys/dev/amr/amr_disk.c +++ b/sys/dev/amr/amr_disk.c @@ -157,9 +157,9 @@ amrd_dump(void *arg, void *virtual, vm_offset_t physical, off_t offset, size_t l dp = arg; amrd_sc = (struct amrd_softc *)dp->d_drv1; - amr_sc = (struct amr_softc *)amrd_sc->amrd_controller; - if (!amrd_sc || !amr_sc) + if (amrd_sc == NULL) return(ENXIO); + amr_sc = (struct amr_softc *)amrd_sc->amrd_controller; if (length > 0) { int driveno = amrd_sc->amrd_drive - amr_sc->amr_drive;