git: 5f607128c9fb - stable/15 - ufshci: report the highest LUN number in the path inquiry

From: Jaeyoon Choi <jaeyoon_at_FreeBSD.org>
Date: Tue, 06 Oct 2026 07:51:26 UTC
The branch stable/15 has been updated by jaeyoon:

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

commit 5f607128c9fb20d487b8b040a65172a9bd83387e
Author:     Jaeyoon Choi <jaeyoon@FreeBSD.org>
AuthorDate: 2026-08-18 05:09:21 +0000
Commit:     Jaeyoon Choi <jaeyoon@FreeBSD.org>
CommitDate: 2026-10-06 06:28:04 +0000

    ufshci: report the highest LUN number in the path inquiry
    
    cpi->max_lun is an inclusive upper bound, but the driver reported the
    LUN count (8 or 32), so CAM probed one nonexistent LUN past the end.
    
    Reviewed by:            imp (mentor)
    Sponsored by:           Samsung Electronics
    Differential Revision:  https://reviews.freebsd.org/D58820
    
    (cherry picked from commit 68091ebf0a72b58424e6b57d6ff9687af9043003)
---
 sys/dev/ufshci/ufshci_sim.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys/dev/ufshci/ufshci_sim.c b/sys/dev/ufshci/ufshci_sim.c
index 8ac47fc4a2dc..2d9a425f6439 100644
--- a/sys/dev/ufshci/ufshci_sim.c
+++ b/sys/dev/ufshci/ufshci_sim.c
@@ -271,7 +271,7 @@ ufshci_cam_action(struct cam_sim *sim, union ccb *ccb)
 		cpi->hba_misc = need_scan_wluns | PIM_UNMAPPED | PIM_NO_6_BYTE;
 		cpi->hba_eng_cnt = 0;
 		cpi->max_target = 0;
-		cpi->max_lun = ctrlr->max_lun_count;
+		cpi->max_lun = ctrlr->max_lun_count - 1;
 		cpi->async_flags = 0;
 		cpi->maxio = ctrlr->max_xfer_size;
 		cpi->initiator_id = 1;