From 33ee8871ab7b456d1a39c84552e5f8853c9d85fa Mon Sep 17 00:00:00 2001 From: gaochuan4 Date: Fri, 25 Oct 2019 15:48:21 +0800 Subject: [PATCH] hisi_sas: Change int to unsigned int to avoid the overflow risk of left shift Operators. driver inclusion category: bugfix bugzilla: NA CVE: NA "4 << 29" exceeds the max value of int type, so "4" needs to be changed as unsigned int type. Signed-off-by: gaochuan (E) Reviewed-by: zhouyupeng1 Reviewed-by: chenxiang Signed-off-by: Yang Yingliang --- drivers/scsi/hisi_sas/hisi_sas_v3_hw.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c b/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c index 897abcbd9e89..caab49f2f7d8 100644 --- a/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c +++ b/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c @@ -1458,7 +1458,7 @@ static void prep_ata_v3_hw(struct hisi_hba *hisi_hba, if (parent_dev && DEV_IS_EXPANDER(parent_dev->dev_type)) hdr->dw0 |= cpu_to_le32(3 << CMD_HDR_CMD_OFF); /* STP */ else - hdr->dw0 |= cpu_to_le32(4 << CMD_HDR_CMD_OFF); /* SATA */ + hdr->dw0 |= cpu_to_le32(4U << CMD_HDR_CMD_OFF); /* SATA */ switch (task->data_dir) { case DMA_TO_DEVICE: @@ -1529,7 +1529,7 @@ static void prep_abort_v3_hw(struct hisi_hba *hisi_hba, struct hisi_sas_port *port = slot->port; /* dw0 */ - hdr->dw0 = cpu_to_le32((5 << CMD_HDR_CMD_OFF) | /*abort*/ + hdr->dw0 = cpu_to_le32((5U << CMD_HDR_CMD_OFF) | /*abort*/ (port->id << CMD_HDR_PORT_OFF) | (dev_is_sata(dev) << CMD_HDR_ABORT_DEVICE_TYPE_OFF) | -- GitLab