Check that twed_sc is non-NULL before dereferencing it, not after.
Reported by: "Ted Unangst" <tedu@coverity.com> Approved by: rwatson (mentor)
This commit is contained in:
parent
1f0c8eae54
commit
cd8aaf2121
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=126115
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user