diff options
author | cperciva <cperciva@FreeBSD.org> | 2004-02-22 09:58:34 +0000 |
---|---|---|
committer | cperciva <cperciva@FreeBSD.org> | 2004-02-22 09:58:34 +0000 |
commit | d511be05d7ef09f80241da0f72c499aa48423b7d (patch) | |
tree | 901d43266c497113e43d642672021c3745cd2a69 | |
parent | 11443ed5cb7895dd184ec0cd5163eb79b305ac15 (diff) | |
download | FreeBSD-src-d511be05d7ef09f80241da0f72c499aa48423b7d.zip FreeBSD-src-d511be05d7ef09f80241da0f72c499aa48423b7d.tar.gz |
Check that twed_sc is non-NULL before dereferencing it, not after.
Reported by: "Ted Unangst" <tedu@coverity.com>
Approved by: rwatson (mentor)
-rw-r--r-- | sys/dev/twe/twe_freebsd.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/sys/dev/twe/twe_freebsd.c b/sys/dev/twe/twe_freebsd.c index 32175c1..1f13391 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) |