Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 26 May 2021 20:37:42 GMT
From:      Mark Johnston <markj@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: a8a91efa74e0 - releng/13.0 - mpt(4): Remove incorrect S/G segments limits.
Message-ID:  <202105262037.14QKbgUg054331@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch releng/13.0 has been updated by markj:

URL: https://cgit.FreeBSD.org/src/commit/?id=a8a91efa74e09f35ecde161f6bb18f10e28efddf

commit a8a91efa74e09f35ecde161f6bb18f10e28efddf
Author:     Alexander Motin <mav@FreeBSD.org>
AuthorDate: 2021-04-17 14:41:35 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2021-05-26 19:29:54 +0000

    mpt(4): Remove incorrect S/G segments limits.
    
    First, two of those four checks are unreachable.
    Second, I don't believe there should be ">=" instead of ">".
    Third, bus_dma(9) already returns the same EFBIG if ">".
    
    This fixes false I/O errors in worst S/G cases with maxphys >= 2MB.
    
    Approved by:    so
    Security:       EN-21:13.mpt
    MFC after:      1 week
    
    (cherry picked from commit 0f29396e493bd87ffa6a63fcb602b12e79d21a1e)
    (cherry picked from commit f0077b4c1dcfa7eda6efadf197e8423fe002ac5d)
---
 sys/dev/mpt/mpt_cam.c | 20 --------------------
 1 file changed, 20 deletions(-)

diff --git a/sys/dev/mpt/mpt_cam.c b/sys/dev/mpt/mpt_cam.c
index 90c84eee2442..64776d673674 100644
--- a/sys/dev/mpt/mpt_cam.c
+++ b/sys/dev/mpt/mpt_cam.c
@@ -1292,10 +1292,6 @@ mpt_execute_req_a64(void *arg, bus_dma_segment_t *dm_segs, int nseg, int error)
 	hdrp = req->req_vbuf;
 	mpt_off = req->req_vbuf;
 
-	if (error == 0 && ((uint32_t)nseg) >= mpt->max_seg_cnt) {
-		error = EFBIG;
-	}
-
 	if (error == 0) {
 		switch (hdrp->Function) {
 		case MPI_FUNCTION_SCSI_IO_REQUEST:
@@ -1315,12 +1311,6 @@ mpt_execute_req_a64(void *arg, bus_dma_segment_t *dm_segs, int nseg, int error)
 		}
 	}
 
-	if (error == 0 && ((uint32_t)nseg) >= mpt->max_seg_cnt) {
-		error = EFBIG;
-		mpt_prt(mpt, "segment count %d too large (max %u)\n",
-		    nseg, mpt->max_seg_cnt);
-	}
-
 bad:
 	if (error != 0) {
 		if (error != EFBIG && error != ENOMEM) {
@@ -1694,10 +1684,6 @@ mpt_execute_req(void *arg, bus_dma_segment_t *dm_segs, int nseg, int error)
 	hdrp = req->req_vbuf;
 	mpt_off = req->req_vbuf;
 
-	if (error == 0 && ((uint32_t)nseg) >= mpt->max_seg_cnt) {
-		error = EFBIG;
-	}
-
 	if (error == 0) {
 		switch (hdrp->Function) {
 		case MPI_FUNCTION_SCSI_IO_REQUEST:
@@ -1716,12 +1702,6 @@ mpt_execute_req(void *arg, bus_dma_segment_t *dm_segs, int nseg, int error)
 		}
 	}
 
-	if (error == 0 && ((uint32_t)nseg) >= mpt->max_seg_cnt) {
-		error = EFBIG;
-		mpt_prt(mpt, "segment count %d too large (max %u)\n",
-		    nseg, mpt->max_seg_cnt);
-	}
-
 bad:
 	if (error != 0) {
 		if (error != EFBIG && error != ENOMEM) {



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202105262037.14QKbgUg054331>