Date: Wed, 10 Oct 2012 18:34:16 +0000 (UTC) From: Alexander Motin <mav@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r241405 - head/sys/cam Message-ID: <201210101834.q9AIYGsN079115@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: mav Date: Wed Oct 10 18:34:15 2012 New Revision: 241405 URL: http://svn.freebsd.org/changeset/base/241405 Log: 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 Modified: head/sys/cam/cam_xpt.c Modified: head/sys/cam/cam_xpt.c ============================================================================== --- head/sys/cam/cam_xpt.c Wed Oct 10 18:10:11 2012 (r241404) +++ head/sys/cam/cam_xpt.c Wed Oct 10 18:34:15 2012 (r241405) @@ -3898,8 +3898,11 @@ xpt_bus_register(struct cam_sim *sim, de 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;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201210101834.q9AIYGsN079115>