Fix potential division by zero after r275920.

Reported by:	Coverity Scan
CID:		1260387
MFC after:	3 days
This commit is contained in:
Alexander Motin 2014-12-23 10:18:42 +00:00
parent 51f529b50b
commit 1f69310e70
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=276127

View File

@ -569,6 +569,8 @@ ctl_backend_ramdisk_create(struct ctl_be_ramdisk_softc *softc,
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_ramdisk_softc *softc,
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) {