summaryrefslogtreecommitdiffstats
path: root/sys/cam
diff options
context:
space:
mode:
authormav <mav@FreeBSD.org>2012-10-10 18:34:15 +0000
committermav <mav@FreeBSD.org>2012-10-10 18:34:15 +0000
commit9e15eadd181311f674215ea14e508faa724685b0 (patch)
tree5cc248f9710894255dd24dfe48153ef3362942de /sys/cam
parent35f2c3dc00c1aac971529a7b75103cb3f83c99b2 (diff)
downloadFreeBSD-src-9e15eadd181311f674215ea14e508faa724685b0.zip
FreeBSD-src-9e15eadd181311f674215ea14e508faa724685b0.tar.gz
Really handle xpt_compile_path() error in xpt_bus_register() instead of
print error message and probably crash just after it on NULL dereference. Found by: Clang Static Analyzer
Diffstat (limited to 'sys/cam')
-rw-r--r--sys/cam/cam_xpt.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/sys/cam/cam_xpt.c b/sys/cam/cam_xpt.c
index 4a174d7..152782e 100644
--- a/sys/cam/cam_xpt.c
+++ b/sys/cam/cam_xpt.c
@@ -3898,8 +3898,11 @@ xpt_bus_register(struct cam_sim *sim, device_t parent, u_int32_t bus)
status = xpt_compile_path(path, /*periph*/NULL, sim->path_id,
CAM_TARGET_WILDCARD, CAM_LUN_WILDCARD);
- if (status != CAM_REQ_CMP)
- printf("xpt_compile_path returned %d\n", status);
+ if (status != CAM_REQ_CMP) {
+ xpt_release_bus(new_bus);
+ free(path, M_CAMXPT);
+ return (CAM_RESRC_UNAVAIL);
+ }
xpt_setup_ccb(&cpi.ccb_h, path, CAM_PRIORITY_NORMAL);
cpi.ccb_h.func_code = XPT_PATH_INQ;
OpenPOWER on IntegriCloud