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
This commit is contained in:
parent
aa2a1aaf90
commit
627995dcde
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=241405
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user