提交 33ee8871 编写于 作者: G gaochuan4 提交者: Xie XiuQi

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: Ngaochuan (E) <gaochuan4@huawei.com>
Reviewed-by: Nzhouyupeng1 <zhouyupeng1@huawei.com>
Reviewed-by: Nchenxiang <chenxiang66@hisilicon.com>
Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
上级 6c9e09ae
...@@ -1458,7 +1458,7 @@ static void prep_ata_v3_hw(struct hisi_hba *hisi_hba, ...@@ -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)) if (parent_dev && DEV_IS_EXPANDER(parent_dev->dev_type))
hdr->dw0 |= cpu_to_le32(3 << CMD_HDR_CMD_OFF); /* STP */ hdr->dw0 |= cpu_to_le32(3 << CMD_HDR_CMD_OFF); /* STP */
else 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) { switch (task->data_dir) {
case DMA_TO_DEVICE: case DMA_TO_DEVICE:
...@@ -1529,7 +1529,7 @@ static void prep_abort_v3_hw(struct hisi_hba *hisi_hba, ...@@ -1529,7 +1529,7 @@ static void prep_abort_v3_hw(struct hisi_hba *hisi_hba,
struct hisi_sas_port *port = slot->port; struct hisi_sas_port *port = slot->port;
/* dw0 */ /* 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) | (port->id << CMD_HDR_PORT_OFF) |
(dev_is_sata(dev) (dev_is_sata(dev)
<< CMD_HDR_ABORT_DEVICE_TYPE_OFF) | << CMD_HDR_ABORT_DEVICE_TYPE_OFF) |
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册