diff mbox series

[01/14] scsi: advansys: Simplified memcpy length calculation in adv_build_req

Message ID 20240626101342.1440049-2-prabhakar.pujeri@gmail.com (mailing list archive)
State Rejected
Headers show
Series SCSI: Replace ternary operations with min()/max() macros | expand

Commit Message

Prabhakar Pujeri June 26, 2024, 10:13 a.m. UTC
Signed-off-by: Prabhakar Pujeri <prabhakar.pujeri@gmail.com>
---
 drivers/scsi/advansys.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/drivers/scsi/advansys.c b/drivers/scsi/advansys.c
index ab066bb27a57..e5ae43e00f24 100644
--- a/drivers/scsi/advansys.c
+++ b/drivers/scsi/advansys.c
@@ -7691,7 +7691,7 @@  adv_build_req(struct asc_board *boardp, struct scsi_cmnd *scp,
 	/* Set CDB length and copy it to the request structure.  */
 	scsiqp->cdb_len = scp->cmd_len;
 	/* Copy first 12 CDB bytes to cdb[]. */
-	memcpy(scsiqp->cdb, scp->cmnd, scp->cmd_len < 12 ? scp->cmd_len : 12);
+	memcpy(scsiqp->cdb, scp->cmnd, min(scp->cmd_len, 12));
 	/* Copy last 4 CDB bytes, if present, to cdb16[]. */
 	if (scp->cmd_len > 12) {
 		int cdb16_len = scp->cmd_len - 12;