Date: Tue, 23 Dec 2014 10:18:43 +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: r276127 - head/sys/cam/ctl Message-ID: <201412231018.sBNAIh2w038759@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: mav Date: Tue Dec 23 10:18:42 2014 New Revision: 276127 URL: https://svnweb.freebsd.org/changeset/base/276127 Log: Fix potential division by zero after r275920. Reported by: Coverity Scan CID: 1260387 MFC after: 3 days Modified: head/sys/cam/ctl/ctl_backend_ramdisk.c Modified: head/sys/cam/ctl/ctl_backend_ramdisk.c ============================================================================== --- head/sys/cam/ctl/ctl_backend_ramdisk.c Tue Dec 23 10:07:23 2014 (r276126) +++ head/sys/cam/ctl/ctl_backend_ramdisk.c Tue Dec 23 10:18:42 2014 (r276127) @@ -569,6 +569,8 @@ ctl_backend_ramdisk_create(struct ctl_be be_lun->size_bytes = be_lun->size_blocks * blocksize; be_lun->ctl_be_lun.maxlba = be_lun->size_blocks - 1; + be_lun->ctl_be_lun.atomicblock = UINT32_MAX; + be_lun->ctl_be_lun.opttxferlen = softc->rd_size / blocksize; } else { be_lun->ctl_be_lun.maxlba = 0; blocksize = 0; @@ -595,8 +597,6 @@ ctl_backend_ramdisk_create(struct ctl_be be_lun->ctl_be_lun.flags = CTL_LUN_FLAG_PRIMARY; if (unmap) be_lun->ctl_be_lun.flags |= CTL_LUN_FLAG_UNMAP; - be_lun->ctl_be_lun.atomicblock = UINT32_MAX; - be_lun->ctl_be_lun.opttxferlen = softc->rd_size / blocksize; be_lun->ctl_be_lun.be_lun = be_lun; if (params->flags & CTL_LUN_FLAG_ID_REQ) {
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201412231018.sBNAIh2w038759>