From c5ff3b2fed69c49493902e97575b3e98dcad67da Mon Sep 17 00:00:00 2001 From: Matt Jacob Date: Wed, 4 Jul 2001 05:22:42 +0000 Subject: [PATCH] Check the void * argument in the AC_FOUND_DEV case against NULL. Whether correctly or not, this sometimes is propagated up via XPT. --- sys/cam/scsi/scsi_cd.c | 2 ++ sys/cam/scsi/scsi_ch.c | 2 ++ sys/cam/scsi/scsi_da.c | 4 +++- sys/cam/scsi/scsi_pass.c | 2 ++ sys/cam/scsi/scsi_pt.c | 2 ++ sys/cam/scsi/scsi_sa.c | 2 ++ sys/cam/scsi/scsi_ses.c | 3 +++ 7 files changed, 16 insertions(+), 1 deletion(-) diff --git a/sys/cam/scsi/scsi_cd.c b/sys/cam/scsi/scsi_cd.c index 6c12ed295fe9..ca6122cc429c 100644 --- a/sys/cam/scsi/scsi_cd.c +++ b/sys/cam/scsi/scsi_cd.c @@ -505,6 +505,8 @@ cdasync(void *callback_arg, u_int32_t code, cam_status status; cgd = (struct ccb_getdev *)arg; + if (cgd == NULL) + break; if (SID_TYPE(&cgd->inq_data) != T_CDROM && SID_TYPE(&cgd->inq_data) != T_WORM) diff --git a/sys/cam/scsi/scsi_ch.c b/sys/cam/scsi/scsi_ch.c index 9ec85c8e1ea7..7d9bba38dfb3 100644 --- a/sys/cam/scsi/scsi_ch.c +++ b/sys/cam/scsi/scsi_ch.c @@ -325,6 +325,8 @@ chasync(void *callback_arg, u_int32_t code, struct cam_path *path, void *arg) cam_status status; cgd = (struct ccb_getdev *)arg; + if (cgd == NULL) + break; if (SID_TYPE(&cgd->inq_data)!= T_CHANGER) break; diff --git a/sys/cam/scsi/scsi_da.c b/sys/cam/scsi/scsi_da.c index c1c9e3057aa9..5c705d5b1890 100644 --- a/sys/cam/scsi/scsi_da.c +++ b/sys/cam/scsi/scsi_da.c @@ -894,6 +894,8 @@ daasync(void *callback_arg, u_int32_t code, cam_status status; cgd = (struct ccb_getdev *)arg; + if (cgd == NULL) + break; if (SID_TYPE(&cgd->inq_data) != T_DIRECT && SID_TYPE(&cgd->inq_data) != T_OPTICAL) @@ -1101,7 +1103,7 @@ dastart(struct cam_periph *periph, union ccb *start_ccb) tag_code = MSG_SIMPLE_Q_TAG; } scsi_read_write(&start_ccb->csio, - /*retries*/4, + /*retries*/4, /* retry a few times */ dadone, tag_code, bp->bio_cmd == BIO_READ, diff --git a/sys/cam/scsi/scsi_pass.c b/sys/cam/scsi/scsi_pass.c index 6dc25d47d238..c6ed554368e9 100644 --- a/sys/cam/scsi/scsi_pass.c +++ b/sys/cam/scsi/scsi_pass.c @@ -237,6 +237,8 @@ passasync(void *callback_arg, u_int32_t code, cam_status status; cgd = (struct ccb_getdev *)arg; + if (cgd == NULL) + break; /* * Allocate a peripheral instance for diff --git a/sys/cam/scsi/scsi_pt.c b/sys/cam/scsi/scsi_pt.c index a1fe60760302..0211d4dfd82d 100644 --- a/sys/cam/scsi/scsi_pt.c +++ b/sys/cam/scsi/scsi_pt.c @@ -446,6 +446,8 @@ ptasync(void *callback_arg, u_int32_t code, struct cam_path *path, void *arg) cam_status status; cgd = (struct ccb_getdev *)arg; + if (cgd == NULL) + break; if (SID_TYPE(&cgd->inq_data) != T_PROCESSOR) break; diff --git a/sys/cam/scsi/scsi_sa.c b/sys/cam/scsi/scsi_sa.c index 91180edf5242..ae1ed5757ea8 100644 --- a/sys/cam/scsi/scsi_sa.c +++ b/sys/cam/scsi/scsi_sa.c @@ -1375,6 +1375,8 @@ saasync(void *callback_arg, u_int32_t code, cam_status status; cgd = (struct ccb_getdev *)arg; + if (cgd == NULL) + break; if (SID_TYPE(&cgd->inq_data) != T_SEQUENTIAL) break; diff --git a/sys/cam/scsi/scsi_ses.c b/sys/cam/scsi/scsi_ses.c index 75c41ba3eb3b..635556e2b6d8 100644 --- a/sys/cam/scsi/scsi_ses.c +++ b/sys/cam/scsi/scsi_ses.c @@ -288,6 +288,9 @@ sesasync(void *callback_arg, u_int32_t code, struct cam_path *path, void *arg) int inq_len; cgd = (struct ccb_getdev *)arg; + if (arg == NULL) { + break; + } inq_len = cgd->inq_data.additional_length + 4;