diff options
author | trasz <trasz@FreeBSD.org> | 2009-01-23 21:05:16 +0000 |
---|---|---|
committer | trasz <trasz@FreeBSD.org> | 2009-01-23 21:05:16 +0000 |
commit | fa6d1261af186403e4722ffa6aeeff18692d7794 (patch) | |
tree | 52b929f35a76f369fb859dafd41cbc82aba7a982 /sys/cam | |
parent | 384c3ce8d25837258013a1eefd7267c75f6df4f6 (diff) | |
download | FreeBSD-src-fa6d1261af186403e4722ffa6aeeff18692d7794.zip FreeBSD-src-fa6d1261af186403e4722ffa6aeeff18692d7794.tar.gz |
Guard against NULL pointer dereference.
Reviewed by: scottl
Approved by: rwatson (mentor)
Sponsored by: FreeBSD Foundation
Found with: Coverity Prevent(tm)
CID: 1847
Diffstat (limited to 'sys/cam')
-rw-r--r-- | sys/cam/cam_xpt.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/sys/cam/cam_xpt.c b/sys/cam/cam_xpt.c index d4736b3..112476b 100644 --- a/sys/cam/cam_xpt.c +++ b/sys/cam/cam_xpt.c @@ -4177,7 +4177,10 @@ xpt_path_string(struct cam_path *path, char *str, size_t str_len) { struct sbuf sb; - mtx_assert(path->bus->sim->mtx, MA_OWNED); +#ifdef INVARIANTS + if (path != NULL && path->bus != NULL && path->bus->sim != NULL) + mtx_assert(path->bus->sim->mtx, MA_OWNED); +#endif sbuf_new(&sb, str, str_len, 0); |