From owner-p4-projects@FreeBSD.ORG Thu Jan 21 11:24:17 2010 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 766571065670; Thu, 21 Jan 2010 11:24:17 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2150E106566C for ; Thu, 21 Jan 2010 11:24:17 +0000 (UTC) (envelope-from mav@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id 0715F8FC16 for ; Thu, 21 Jan 2010 11:24:17 +0000 (UTC) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.3/8.14.3) with ESMTP id o0LBOGrq031361 for ; Thu, 21 Jan 2010 11:24:16 GMT (envelope-from mav@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.3/8.14.3/Submit) id o0LBOGiX031359 for perforce@freebsd.org; Thu, 21 Jan 2010 11:24:16 GMT (envelope-from mav@freebsd.org) Date: Thu, 21 Jan 2010 11:24:16 GMT Message-Id: <201001211124.o0LBOGiX031359@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to mav@freebsd.org using -f From: Alexander Motin To: Perforce Change Reviews Precedence: bulk Cc: Subject: PERFORCE change 173451 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Jan 2010 11:24:17 -0000 http://p4web.freebsd.org/chv.cgi?CH=173451 Change 173451 by mav@mav_mavtest on 2010/01/21 11:24:06 Do not allocate ccb_getdev on stack. It is too large for this. Affected files ... .. //depot/projects/scottl-camlock/src/sys/cam/scsi/scsi_all.c#12 edit Differences ... ==== //depot/projects/scottl-camlock/src/sys/cam/scsi/scsi_all.c#12 (text+ko) ==== @@ -2995,27 +2995,29 @@ struct scsi_inquiry_data *inq_data; char cdb_str[(SCSI_MAX_CDBLEN * 3) + 1]; #ifdef _KERNEL - struct ccb_getdev cgd; + struct ccb_getdev *cgd; #endif /* _KERNEL */ #ifdef _KERNEL + if ((cgd = (struct ccb_getdev*)xpt_alloc_ccb_nowait()) == NULL) + return(-1); /* * Get the device information. */ - xpt_setup_ccb(&cgd.ccb_h, + xpt_setup_ccb(&cgd->ccb_h, csio->ccb_h.path, CAM_PRIORITY_NORMAL); - cgd.ccb_h.func_code = XPT_GDEV_TYPE; - xpt_action((union ccb *)&cgd); + cgd->ccb_h.func_code = XPT_GDEV_TYPE; + xpt_action((union ccb *)cgd); /* * If the device is unconfigured, just pretend that it is a hard * drive. scsi_op_desc() needs this. */ - if (cgd.ccb_h.status == CAM_DEV_NOT_THERE) - cgd.inq_data.device = T_DIRECT; + if (cgd->ccb_h.status == CAM_DEV_NOT_THERE) + cgd->inq_data.device = T_DIRECT; - inq_data = &cgd.inq_data; + inq_data = &cgd->inq_data; #else /* !_KERNEL */ @@ -3055,7 +3057,7 @@ struct scsi_sense_data *sense; struct scsi_inquiry_data *inq_data; #ifdef _KERNEL - struct ccb_getdev cgd; + struct ccb_getdev *cgd; #endif /* _KERNEL */ u_int32_t info; int error_code; @@ -3083,23 +3085,25 @@ #endif /* _KERNEL/!_KERNEL */ #ifdef _KERNEL + if ((cgd = (struct ccb_getdev*)xpt_alloc_ccb_nowait()) == NULL) + return(-1); /* * Get the device information. */ - xpt_setup_ccb(&cgd.ccb_h, + xpt_setup_ccb(&cgd->ccb_h, csio->ccb_h.path, CAM_PRIORITY_NORMAL); - cgd.ccb_h.func_code = XPT_GDEV_TYPE; - xpt_action((union ccb *)&cgd); + cgd->ccb_h.func_code = XPT_GDEV_TYPE; + xpt_action((union ccb *)cgd); /* * If the device is unconfigured, just pretend that it is a hard * drive. scsi_op_desc() needs this. */ - if (cgd.ccb_h.status == CAM_DEV_NOT_THERE) - cgd.inq_data.device = T_DIRECT; + if (cgd->ccb_h.status == CAM_DEV_NOT_THERE) + cgd->inq_data.device = T_DIRECT; - inq_data = &cgd.inq_data; + inq_data = &cgd->inq_data; #else /* !_KERNEL */ @@ -3125,9 +3129,10 @@ * If the sense data is a physical pointer, forget it. */ if (csio->ccb_h.flags & CAM_SENSE_PTR) { - if (csio->ccb_h.flags & CAM_SENSE_PHYS) + if (csio->ccb_h.flags & CAM_SENSE_PHYS) { + xpt_free_ccb((union ccb*)cgd); return(-1); - else { + } else { /* * bcopy the pointer to avoid unaligned access * errors on finicky architectures. We don't @@ -3145,9 +3150,10 @@ * dumped on one of the bogus pointer deferences above * already.) */ - if (csio->ccb_h.flags & CAM_SENSE_PHYS) + if (csio->ccb_h.flags & CAM_SENSE_PHYS) { + xpt_free_ccb((union ccb*)cgd); return(-1); - else + } else sense = &csio->sense_data; } @@ -3274,6 +3280,7 @@ sbuf_printf(sb, "\n"); + xpt_free_ccb((union ccb*)cgd); return(0); }