diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2004-03-26 00:04:52 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2004-03-26 00:04:52 +0000 |
commit | 5e9ea134af3890e3042b743370bfd71b9d5ff976 (patch) | |
tree | ff7fa7b5d4c64c540132b293ba05296e8a24006f /sys | |
parent | c49c4cae05c54580709aba6ae8149776ab11dd04 (diff) |
Do not dereference pointers before checking whether they are valid (triple sigh).
ok deraadt@
Diffstat (limited to 'sys')
-rw-r--r-- | sys/arch/mvme68k/dev/ssh.c | 24 | ||||
-rw-r--r-- | sys/arch/mvme88k/dev/ssh.c | 8 |
2 files changed, 20 insertions, 12 deletions
diff --git a/sys/arch/mvme68k/dev/ssh.c b/sys/arch/mvme68k/dev/ssh.c index 6b3b5428298..87e09680194 100644 --- a/sys/arch/mvme68k/dev/ssh.c +++ b/sys/arch/mvme68k/dev/ssh.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ssh.c,v 1.8 2004/03/04 23:02:22 miod Exp $ */ +/* $OpenBSD: ssh.c,v 1.9 2004/03/26 00:04:49 miod Exp $ */ /* * Copyright (c) 1994 Michael L. Hitch @@ -315,18 +315,26 @@ struct ssh_softc *sc; void ssh_scsidone(acb, stat) -struct ssh_acb *acb; -int stat; + struct ssh_acb *acb; + int stat; { - struct scsi_xfer *xs = acb->xs; - struct scsi_link *slp = xs->sc_link; - struct ssh_softc *sc = slp->adapter_softc; + struct scsi_xfer *xs; + struct scsi_link *slp; + struct ssh_softc *sc; int dosched = 0; + if (acb == NULL || (xs = acb->xs) == NULL) { #ifdef DIAGNOSTIC - if (acb == NULL || xs == NULL) - panic("ssh_scsidone"); + printf("ssh_scsidone: NULL acb or scsi_xfer\n"); +#if defined(DEBUG) && defined(DDB) + Debugger(); #endif +#endif + return; + } + slp = xs->sc_link; + sc = slp->adapter_softc; + /* * is this right? */ diff --git a/sys/arch/mvme88k/dev/ssh.c b/sys/arch/mvme88k/dev/ssh.c index 92330c2dbb0..0512b281923 100644 --- a/sys/arch/mvme88k/dev/ssh.c +++ b/sys/arch/mvme88k/dev/ssh.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ssh.c,v 1.25 2004/03/04 23:02:23 miod Exp $ */ +/* $OpenBSD: ssh.c,v 1.26 2004/03/26 00:04:51 miod Exp $ */ /* * Copyright (c) 1994 Michael L. Hitch @@ -573,9 +573,9 @@ ssh_scsidone(acb, stat) struct ssh_acb *acb; int stat; { - struct scsi_xfer *xs = acb->xs; - struct scsi_link *slp = xs->sc_link; - struct ssh_softc *sc = slp->adapter_softc; + struct scsi_xfer *xs; + struct scsi_link *slp; + struct ssh_softc *sc; int dosched = 0; if (acb == NULL || (xs = acb->xs) == NULL) { |