diff mbox series

[v3,09/18] megaraid_sas: megaraid_sas: Add check for count returned by HOST_DEVICE_LIST DCMD

Message ID 20190625110436.4703-10-chandrakanth.patil@broadcom.com (mailing list archive)
State Accepted
Headers show
Series megaraid_sas: driver updates to 07.710.06.00-rc1 | expand

Commit Message

Chandrakanth Patil June 25, 2019, 11:04 a.m. UTC
Signed-off-by: Shivasharan S <shivasharan.srikanteshwara@broadcom.com>
Signed-off-by: Chandrakanth Patil <chandrakanth.patil@broadcom.com>
---
 drivers/scsi/megaraid/megaraid_sas_base.c | 3 +++
 1 file changed, 3 insertions(+)
diff mbox series

Patch

diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c
index 554ec72..a886de3e3 100644
--- a/drivers/scsi/megaraid/megaraid_sas_base.c
+++ b/drivers/scsi/megaraid/megaraid_sas_base.c
@@ -4827,6 +4827,9 @@  megasas_host_device_list_query(struct megasas_instance *instance,
 		 */
 		count = le32_to_cpu(ci->count);
 
+		if (count > (MEGASAS_MAX_PD + MAX_LOGICAL_DRIVES_EXT))
+			break;
+
 		if (megasas_dbg_lvl & LD_PD_DEBUG)
 			dev_info(&instance->pdev->dev, "%s, Device count: 0x%x\n",
 				 __func__, count);