aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/twe
diff options
context:
space:
mode:
authorColin Percival <cperciva@FreeBSD.org>2004-02-22 09:58:34 +0000
committerColin Percival <cperciva@FreeBSD.org>2004-02-22 09:58:34 +0000
commitcd8aaf212102bdad98092dfbe89be33c3bfca9e0 (patch)
tree901d43266c497113e43d642672021c3745cd2a69 /sys/dev/twe
parent1f0c8eae54cfc1583d70b62b325d72e8f4881edb (diff)
downloadsrc-cd8aaf212102bdad98092dfbe89be33c3bfca9e0.tar.gz
src-cd8aaf212102bdad98092dfbe89be33c3bfca9e0.zip
Check that twed_sc is non-NULL before dereferencing it, not after.
Reported by: "Ted Unangst" <tedu@coverity.com> Approved by: rwatson (mentor)
Notes
Notes: svn path=/head/; revision=126115
Diffstat (limited to 'sys/dev/twe')
-rw-r--r--sys/dev/twe/twe_freebsd.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/sys/dev/twe/twe_freebsd.c b/sys/dev/twe/twe_freebsd.c
index 32175c13a379..1f13391bb07f 100644
--- a/sys/dev/twe/twe_freebsd.c
+++ b/sys/dev/twe/twe_freebsd.c
@@ -744,9 +744,9 @@ twed_dump(void *arg, void *virtual, vm_offset_t physical, off_t offset, size_t l
dp = arg;
twed_sc = (struct twed_softc *)dp->d_drv1;
- twe_sc = (struct twe_softc *)twed_sc->twed_controller;
- if (!twed_sc || !twe_sc)
+ if (twed_sc == NULL)
return(ENXIO);
+ twe_sc = (struct twe_softc *)twed_sc->twed_controller;
if (length > 0) {
if ((error = twe_dump_blocks(twe_sc, twed_sc->twed_drive->td_twe_unit, offset / TWE_BLOCK_SIZE, virtual, length / TWE_BLOCK_SIZE)) != 0)