Skip to content

Commit 91a43fa

Browse files
peter changmartinkpetersen
authored andcommitted
scsi: pm80xx: Fix command issue sizing
The commands to the controller are sent in fixed sized chunks which are set per-chip-generation and stashed in iomb_size. The driver fills in structs matching the register layout and memcpy this to memory shared with the controller. However, there are two problem cases: 1) Things like phy_start_req are too large because they share the sas_identify_frame definition with libsas, and it includes the crc word. This means that it's overwriting the start of the next command block, that's ok except if it happens at the end of the shared memory area. 2) Things like set_nvm_data_req which are shared between the HAL layers. This means that it's sending 'random' data for things that are in the reserved area. So far we haven't found a case where the controller FW cares, but sending possible gibberish (for most of the structures this is in the reserved area so previously zeroed) is not recommended. Link: https://lore.kernel.org/r/[email protected] Acked-by: Jack Wang <[email protected]> Signed-off-by: peter chang <[email protected]> Signed-off-by: Deepak Ukey <[email protected]> Signed-off-by: Viswas G <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
1 parent a88d9db commit 91a43fa

File tree

3 files changed

+79
-40
lines changed

3 files changed

+79
-40
lines changed

drivers/scsi/pm8001/pm8001_hwi.c

Lines changed: 46 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1336,10 +1336,13 @@ int pm8001_mpi_msg_free_get(struct inbound_queue_table *circularQ,
13361336
* @circularQ: the inbound queue we want to transfer to HBA.
13371337
* @opCode: the operation code represents commands which LLDD and fw recognized.
13381338
* @payload: the command payload of each operation command.
1339+
* @nb: size in bytes of the command payload
1340+
* @responseQueue: queue to interrupt on w/ command response (if any)
13391341
*/
13401342
int pm8001_mpi_build_cmd(struct pm8001_hba_info *pm8001_ha,
13411343
struct inbound_queue_table *circularQ,
1342-
u32 opCode, void *payload, u32 responseQueue)
1344+
u32 opCode, void *payload, size_t nb,
1345+
u32 responseQueue)
13431346
{
13441347
u32 Header = 0, hpriority = 0, bc = 1, category = 0x02;
13451348
void *pMessage;
@@ -1350,10 +1353,13 @@ int pm8001_mpi_build_cmd(struct pm8001_hba_info *pm8001_ha,
13501353
pm8001_printk("No free mpi buffer\n"));
13511354
return -ENOMEM;
13521355
}
1353-
BUG_ON(!payload);
1354-
/*Copy to the payload*/
1355-
memcpy(pMessage, payload, (pm8001_ha->iomb_size -
1356-
sizeof(struct mpi_msg_hdr)));
1356+
1357+
if (nb > (pm8001_ha->iomb_size - sizeof(struct mpi_msg_hdr)))
1358+
nb = pm8001_ha->iomb_size - sizeof(struct mpi_msg_hdr);
1359+
memcpy(pMessage, payload, nb);
1360+
if (nb + sizeof(struct mpi_msg_hdr) < pm8001_ha->iomb_size)
1361+
memset(pMessage + nb, 0, pm8001_ha->iomb_size -
1362+
(nb + sizeof(struct mpi_msg_hdr)));
13571363

13581364
/*Build the header*/
13591365
Header = ((1 << 31) | (hpriority << 30) | ((bc & 0x1f) << 24)
@@ -1763,7 +1769,8 @@ static void pm8001_send_abort_all(struct pm8001_hba_info *pm8001_ha,
17631769
task_abort.device_id = cpu_to_le32(pm8001_ha_dev->device_id);
17641770
task_abort.tag = cpu_to_le32(ccb_tag);
17651771

1766-
ret = pm8001_mpi_build_cmd(pm8001_ha, circularQ, opc, &task_abort, 0);
1772+
ret = pm8001_mpi_build_cmd(pm8001_ha, circularQ, opc, &task_abort,
1773+
sizeof(task_abort), 0);
17671774
if (ret)
17681775
pm8001_tag_free(pm8001_ha, ccb_tag);
17691776

@@ -1836,7 +1843,8 @@ static void pm8001_send_read_log(struct pm8001_hba_info *pm8001_ha,
18361843
sata_cmd.ncqtag_atap_dir_m |= ((0x1 << 7) | (0x5 << 9));
18371844
memcpy(&sata_cmd.sata_fis, &fis, sizeof(struct host_to_dev_fis));
18381845

1839-
res = pm8001_mpi_build_cmd(pm8001_ha, circularQ, opc, &sata_cmd, 0);
1846+
res = pm8001_mpi_build_cmd(pm8001_ha, circularQ, opc, &sata_cmd,
1847+
sizeof(sata_cmd), 0);
18401848
if (res) {
18411849
sas_free_task(task);
18421850
pm8001_tag_free(pm8001_ha, ccb_tag);
@@ -3375,7 +3383,8 @@ static void pm8001_hw_event_ack_req(struct pm8001_hba_info *pm8001_ha,
33753383
((phyId & 0x0F) << 4) | (port_id & 0x0F));
33763384
payload.param0 = cpu_to_le32(param0);
33773385
payload.param1 = cpu_to_le32(param1);
3378-
pm8001_mpi_build_cmd(pm8001_ha, circularQ, opc, &payload, 0);
3386+
pm8001_mpi_build_cmd(pm8001_ha, circularQ, opc, &payload,
3387+
sizeof(payload), 0);
33793388
}
33803389

33813390
static int pm8001_chip_phy_ctl_req(struct pm8001_hba_info *pm8001_ha,
@@ -4305,7 +4314,7 @@ static int pm8001_chip_smp_req(struct pm8001_hba_info *pm8001_ha,
43054314
cpu_to_le32((u32)sg_dma_len(&task->smp_task.smp_resp)-4);
43064315
build_smp_cmd(pm8001_dev->device_id, smp_cmd.tag, &smp_cmd);
43074316
rc = pm8001_mpi_build_cmd(pm8001_ha, circularQ, opc,
4308-
(u32 *)&smp_cmd, 0);
4317+
&smp_cmd, sizeof(smp_cmd), 0);
43094318
if (rc)
43104319
goto err_out_2;
43114320

@@ -4373,7 +4382,8 @@ static int pm8001_chip_ssp_io_req(struct pm8001_hba_info *pm8001_ha,
43734382
ssp_cmd.len = cpu_to_le32(task->total_xfer_len);
43744383
ssp_cmd.esgl = 0;
43754384
}
4376-
ret = pm8001_mpi_build_cmd(pm8001_ha, circularQ, opc, &ssp_cmd, 0);
4385+
ret = pm8001_mpi_build_cmd(pm8001_ha, circularQ, opc, &ssp_cmd,
4386+
sizeof(ssp_cmd), 0);
43774387
return ret;
43784388
}
43794389

@@ -4482,7 +4492,8 @@ static int pm8001_chip_sata_req(struct pm8001_hba_info *pm8001_ha,
44824492
}
44834493
}
44844494

4485-
ret = pm8001_mpi_build_cmd(pm8001_ha, circularQ, opc, &sata_cmd, 0);
4495+
ret = pm8001_mpi_build_cmd(pm8001_ha, circularQ, opc, &sata_cmd,
4496+
sizeof(sata_cmd), 0);
44864497
return ret;
44874498
}
44884499

@@ -4517,7 +4528,8 @@ pm8001_chip_phy_start_req(struct pm8001_hba_info *pm8001_ha, u8 phy_id)
45174528
memcpy(payload.sas_identify.sas_addr,
45184529
pm8001_ha->sas_addr, SAS_ADDR_SIZE);
45194530
payload.sas_identify.phy_id = phy_id;
4520-
ret = pm8001_mpi_build_cmd(pm8001_ha, circularQ, opcode, &payload, 0);
4531+
ret = pm8001_mpi_build_cmd(pm8001_ha, circularQ, opcode, &payload,
4532+
sizeof(payload), 0);
45214533
return ret;
45224534
}
45234535

@@ -4539,7 +4551,8 @@ static int pm8001_chip_phy_stop_req(struct pm8001_hba_info *pm8001_ha,
45394551
memset(&payload, 0, sizeof(payload));
45404552
payload.tag = cpu_to_le32(tag);
45414553
payload.phy_id = cpu_to_le32(phy_id);
4542-
ret = pm8001_mpi_build_cmd(pm8001_ha, circularQ, opcode, &payload, 0);
4554+
ret = pm8001_mpi_build_cmd(pm8001_ha, circularQ, opcode, &payload,
4555+
sizeof(payload), 0);
45434556
return ret;
45444557
}
45454558

@@ -4598,7 +4611,8 @@ static int pm8001_chip_reg_dev_req(struct pm8001_hba_info *pm8001_ha,
45984611
cpu_to_le32(ITNT | (firstBurstSize * 0x10000));
45994612
memcpy(payload.sas_addr, pm8001_dev->sas_device->sas_addr,
46004613
SAS_ADDR_SIZE);
4601-
rc = pm8001_mpi_build_cmd(pm8001_ha, circularQ, opc, &payload, 0);
4614+
rc = pm8001_mpi_build_cmd(pm8001_ha, circularQ, opc, &payload,
4615+
sizeof(payload), 0);
46024616
return rc;
46034617
}
46044618

@@ -4619,7 +4633,8 @@ int pm8001_chip_dereg_dev_req(struct pm8001_hba_info *pm8001_ha,
46194633
payload.device_id = cpu_to_le32(device_id);
46204634
PM8001_MSG_DBG(pm8001_ha,
46214635
pm8001_printk("unregister device device_id = %d\n", device_id));
4622-
ret = pm8001_mpi_build_cmd(pm8001_ha, circularQ, opc, &payload, 0);
4636+
ret = pm8001_mpi_build_cmd(pm8001_ha, circularQ, opc, &payload,
4637+
sizeof(payload), 0);
46234638
return ret;
46244639
}
46254640

@@ -4642,7 +4657,8 @@ static int pm8001_chip_phy_ctl_req(struct pm8001_hba_info *pm8001_ha,
46424657
payload.tag = cpu_to_le32(1);
46434658
payload.phyop_phyid =
46444659
cpu_to_le32(((phy_op & 0xff) << 8) | (phyId & 0x0F));
4645-
ret = pm8001_mpi_build_cmd(pm8001_ha, circularQ, opc, &payload, 0);
4660+
ret = pm8001_mpi_build_cmd(pm8001_ha, circularQ, opc, &payload,
4661+
sizeof(payload), 0);
46464662
return ret;
46474663
}
46484664

@@ -4696,7 +4712,8 @@ static int send_task_abort(struct pm8001_hba_info *pm8001_ha, u32 opc,
46964712
task_abort.device_id = cpu_to_le32(dev_id);
46974713
task_abort.tag = cpu_to_le32(cmd_tag);
46984714
}
4699-
ret = pm8001_mpi_build_cmd(pm8001_ha, circularQ, opc, &task_abort, 0);
4715+
ret = pm8001_mpi_build_cmd(pm8001_ha, circularQ, opc, &task_abort,
4716+
sizeof(task_abort), 0);
47004717
return ret;
47014718
}
47024719

@@ -4753,7 +4770,8 @@ int pm8001_chip_ssp_tm_req(struct pm8001_hba_info *pm8001_ha,
47534770
if (pm8001_ha->chip_id != chip_8001)
47544771
sspTMCmd.ds_ads_m = 0x08;
47554772
circularQ = &pm8001_ha->inbnd_q_tbl[0];
4756-
ret = pm8001_mpi_build_cmd(pm8001_ha, circularQ, opc, &sspTMCmd, 0);
4773+
ret = pm8001_mpi_build_cmd(pm8001_ha, circularQ, opc, &sspTMCmd,
4774+
sizeof(sspTMCmd), 0);
47574775
return ret;
47584776
}
47594777

@@ -4843,7 +4861,8 @@ int pm8001_chip_get_nvmd_req(struct pm8001_hba_info *pm8001_ha,
48434861
default:
48444862
break;
48454863
}
4846-
rc = pm8001_mpi_build_cmd(pm8001_ha, circularQ, opc, &nvmd_req, 0);
4864+
rc = pm8001_mpi_build_cmd(pm8001_ha, circularQ, opc, &nvmd_req,
4865+
sizeof(nvmd_req), 0);
48474866
if (rc) {
48484867
kfree(fw_control_context);
48494868
pm8001_tag_free(pm8001_ha, tag);
@@ -4927,7 +4946,8 @@ int pm8001_chip_set_nvmd_req(struct pm8001_hba_info *pm8001_ha,
49274946
default:
49284947
break;
49294948
}
4930-
rc = pm8001_mpi_build_cmd(pm8001_ha, circularQ, opc, &nvmd_req, 0);
4949+
rc = pm8001_mpi_build_cmd(pm8001_ha, circularQ, opc, &nvmd_req,
4950+
sizeof(nvmd_req), 0);
49314951
if (rc) {
49324952
kfree(fw_control_context);
49334953
pm8001_tag_free(pm8001_ha, tag);
@@ -4962,7 +4982,8 @@ pm8001_chip_fw_flash_update_build(struct pm8001_hba_info *pm8001_ha,
49624982
cpu_to_le32(lower_32_bits(le64_to_cpu(info->sgl.addr)));
49634983
payload.sgl_addr_hi =
49644984
cpu_to_le32(upper_32_bits(le64_to_cpu(info->sgl.addr)));
4965-
ret = pm8001_mpi_build_cmd(pm8001_ha, circularQ, opc, &payload, 0);
4985+
ret = pm8001_mpi_build_cmd(pm8001_ha, circularQ, opc, &payload,
4986+
sizeof(payload), 0);
49664987
return ret;
49674988
}
49684989

@@ -5109,7 +5130,8 @@ pm8001_chip_set_dev_state_req(struct pm8001_hba_info *pm8001_ha,
51095130
payload.tag = cpu_to_le32(tag);
51105131
payload.device_id = cpu_to_le32(pm8001_dev->device_id);
51115132
payload.nds = cpu_to_le32(state);
5112-
rc = pm8001_mpi_build_cmd(pm8001_ha, circularQ, opc, &payload, 0);
5133+
rc = pm8001_mpi_build_cmd(pm8001_ha, circularQ, opc, &payload,
5134+
sizeof(payload), 0);
51135135
return rc;
51145136

51155137
}
@@ -5134,7 +5156,8 @@ pm8001_chip_sas_re_initialization(struct pm8001_hba_info *pm8001_ha)
51345156
payload.SSAHOLT = cpu_to_le32(0xd << 25);
51355157
payload.sata_hol_tmo = cpu_to_le32(80);
51365158
payload.open_reject_cmdretries_data_retries = cpu_to_le32(0xff00ff);
5137-
rc = pm8001_mpi_build_cmd(pm8001_ha, circularQ, opc, &payload, 0);
5159+
rc = pm8001_mpi_build_cmd(pm8001_ha, circularQ, opc, &payload,
5160+
sizeof(payload), 0);
51385161
if (rc)
51395162
pm8001_tag_free(pm8001_ha, tag);
51405163
return rc;

drivers/scsi/pm8001/pm8001_sas.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -674,7 +674,8 @@ int pm8001_mem_alloc(struct pci_dev *pdev, void **virt_addr,
674674
void pm8001_chip_iounmap(struct pm8001_hba_info *pm8001_ha);
675675
int pm8001_mpi_build_cmd(struct pm8001_hba_info *pm8001_ha,
676676
struct inbound_queue_table *circularQ,
677-
u32 opCode, void *payload, u32 responseQueue);
677+
u32 opCode, void *payload, size_t nb,
678+
u32 responseQueue);
678679
int pm8001_mpi_msg_free_get(struct inbound_queue_table *circularQ,
679680
u16 messageSize, void **messagePtr);
680681
u32 pm8001_mpi_msg_free_set(struct pm8001_hba_info *pm8001_ha, void *pMsg,

drivers/scsi/pm8001/pm80xx_hwi.c

Lines changed: 31 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -955,7 +955,8 @@ pm80xx_set_thermal_config(struct pm8001_hba_info *pm8001_ha)
955955
"Setting up thermal config. cfg_pg 0 0x%x cfg_pg 1 0x%x\n",
956956
payload.cfg_pg[0], payload.cfg_pg[1]));
957957

958-
rc = pm8001_mpi_build_cmd(pm8001_ha, circularQ, opc, &payload, 0);
958+
rc = pm8001_mpi_build_cmd(pm8001_ha, circularQ, opc, &payload,
959+
sizeof(payload), 0);
959960
if (rc)
960961
pm8001_tag_free(pm8001_ha, tag);
961962
return rc;
@@ -1037,7 +1038,8 @@ pm80xx_set_sas_protocol_timer_config(struct pm8001_hba_info *pm8001_ha)
10371038
memcpy(&payload.cfg_pg, &SASConfigPage,
10381039
sizeof(SASProtocolTimerConfig_t));
10391040

1040-
rc = pm8001_mpi_build_cmd(pm8001_ha, circularQ, opc, &payload, 0);
1041+
rc = pm8001_mpi_build_cmd(pm8001_ha, circularQ, opc, &payload,
1042+
sizeof(payload), 0);
10411043
if (rc)
10421044
pm8001_tag_free(pm8001_ha, tag);
10431045

@@ -1164,7 +1166,8 @@ static int pm80xx_encrypt_update(struct pm8001_hba_info *pm8001_ha)
11641166
"Saving Encryption info to flash. payload 0x%x\n",
11651167
payload.new_curidx_ksop));
11661168

1167-
rc = pm8001_mpi_build_cmd(pm8001_ha, circularQ, opc, &payload, 0);
1169+
rc = pm8001_mpi_build_cmd(pm8001_ha, circularQ, opc, &payload,
1170+
sizeof(payload), 0);
11681171
if (rc)
11691172
pm8001_tag_free(pm8001_ha, tag);
11701173

@@ -1517,7 +1520,10 @@ static void pm80xx_send_abort_all(struct pm8001_hba_info *pm8001_ha,
15171520
task_abort.device_id = cpu_to_le32(pm8001_ha_dev->device_id);
15181521
task_abort.tag = cpu_to_le32(ccb_tag);
15191522

1520-
ret = pm8001_mpi_build_cmd(pm8001_ha, circularQ, opc, &task_abort, 0);
1523+
ret = pm8001_mpi_build_cmd(pm8001_ha, circularQ, opc, &task_abort,
1524+
sizeof(task_abort), 0);
1525+
PM8001_FAIL_DBG(pm8001_ha,
1526+
pm8001_printk("Executing abort task end\n"));
15211527
if (ret) {
15221528
sas_free_task(task);
15231529
pm8001_tag_free(pm8001_ha, ccb_tag);
@@ -1593,7 +1599,9 @@ static void pm80xx_send_read_log(struct pm8001_hba_info *pm8001_ha,
15931599
sata_cmd.ncqtag_atap_dir_m_dad |= ((0x1 << 7) | (0x5 << 9));
15941600
memcpy(&sata_cmd.sata_fis, &fis, sizeof(struct host_to_dev_fis));
15951601

1596-
res = pm8001_mpi_build_cmd(pm8001_ha, circularQ, opc, &sata_cmd, 0);
1602+
res = pm8001_mpi_build_cmd(pm8001_ha, circularQ, opc, &sata_cmd,
1603+
sizeof(sata_cmd), 0);
1604+
PM8001_FAIL_DBG(pm8001_ha, pm8001_printk("Executing read log end\n"));
15971605
if (res) {
15981606
sas_free_task(task);
15991607
pm8001_tag_free(pm8001_ha, ccb_tag);
@@ -2962,7 +2970,8 @@ static void pm80xx_hw_event_ack_req(struct pm8001_hba_info *pm8001_ha,
29622970
((phyId & 0xFF) << 24) | (port_id & 0xFF));
29632971
payload.param0 = cpu_to_le32(param0);
29642972
payload.param1 = cpu_to_le32(param1);
2965-
pm8001_mpi_build_cmd(pm8001_ha, circularQ, opc, &payload, 0);
2973+
pm8001_mpi_build_cmd(pm8001_ha, circularQ, opc, &payload,
2974+
sizeof(payload), 0);
29662975
}
29672976

29682977
static int pm80xx_chip_phy_ctl_req(struct pm8001_hba_info *pm8001_ha,
@@ -4082,8 +4091,8 @@ static int pm80xx_chip_smp_req(struct pm8001_hba_info *pm8001_ha,
40824091

40834092
build_smp_cmd(pm8001_dev->device_id, smp_cmd.tag,
40844093
&smp_cmd, pm8001_ha->smp_exp_mode, length);
4085-
rc = pm8001_mpi_build_cmd(pm8001_ha, circularQ, opc,
4086-
(u32 *)&smp_cmd, 0);
4094+
rc = pm8001_mpi_build_cmd(pm8001_ha, circularQ, opc, &smp_cmd,
4095+
sizeof(smp_cmd), 0);
40874096
if (rc)
40884097
goto err_out_2;
40894098
return 0;
@@ -4291,7 +4300,7 @@ static int pm80xx_chip_ssp_io_req(struct pm8001_hba_info *pm8001_ha,
42914300
}
42924301
q_index = (u32) (pm8001_dev->id & 0x00ffffff) % PM8001_MAX_OUTB_NUM;
42934302
ret = pm8001_mpi_build_cmd(pm8001_ha, circularQ, opc,
4294-
&ssp_cmd, q_index);
4303+
&ssp_cmd, sizeof(ssp_cmd), q_index);
42954304
return ret;
42964305
}
42974306

@@ -4532,7 +4541,7 @@ static int pm80xx_chip_sata_req(struct pm8001_hba_info *pm8001_ha,
45324541
}
45334542
q_index = (u32) (pm8001_ha_dev->id & 0x00ffffff) % PM8001_MAX_OUTB_NUM;
45344543
ret = pm8001_mpi_build_cmd(pm8001_ha, circularQ, opc,
4535-
&sata_cmd, q_index);
4544+
&sata_cmd, sizeof(sata_cmd), q_index);
45364545
return ret;
45374546
}
45384547

@@ -4587,7 +4596,8 @@ pm80xx_chip_phy_start_req(struct pm8001_hba_info *pm8001_ha, u8 phy_id)
45874596
memcpy(payload.sas_identify.sas_addr,
45884597
&pm8001_ha->phy[phy_id].dev_sas_addr, SAS_ADDR_SIZE);
45894598
payload.sas_identify.phy_id = phy_id;
4590-
ret = pm8001_mpi_build_cmd(pm8001_ha, circularQ, opcode, &payload, 0);
4599+
ret = pm8001_mpi_build_cmd(pm8001_ha, circularQ, opcode, &payload,
4600+
sizeof(payload), 0);
45914601
return ret;
45924602
}
45934603

@@ -4609,7 +4619,8 @@ static int pm80xx_chip_phy_stop_req(struct pm8001_hba_info *pm8001_ha,
46094619
memset(&payload, 0, sizeof(payload));
46104620
payload.tag = cpu_to_le32(tag);
46114621
payload.phy_id = cpu_to_le32(phy_id);
4612-
ret = pm8001_mpi_build_cmd(pm8001_ha, circularQ, opcode, &payload, 0);
4622+
ret = pm8001_mpi_build_cmd(pm8001_ha, circularQ, opcode, &payload,
4623+
sizeof(payload), 0);
46134624
return ret;
46144625
}
46154626

@@ -4675,7 +4686,8 @@ static int pm80xx_chip_reg_dev_req(struct pm8001_hba_info *pm8001_ha,
46754686
memcpy(payload.sas_addr, pm8001_dev->sas_device->sas_addr,
46764687
SAS_ADDR_SIZE);
46774688

4678-
rc = pm8001_mpi_build_cmd(pm8001_ha, circularQ, opc, &payload, 0);
4689+
rc = pm8001_mpi_build_cmd(pm8001_ha, circularQ, opc, &payload,
4690+
sizeof(payload), 0);
46794691
if (rc)
46804692
pm8001_tag_free(pm8001_ha, tag);
46814693

@@ -4705,7 +4717,8 @@ static int pm80xx_chip_phy_ctl_req(struct pm8001_hba_info *pm8001_ha,
47054717
payload.tag = cpu_to_le32(tag);
47064718
payload.phyop_phyid =
47074719
cpu_to_le32(((phy_op & 0xFF) << 8) | (phyId & 0xFF));
4708-
return pm8001_mpi_build_cmd(pm8001_ha, circularQ, opc, &payload, 0);
4720+
return pm8001_mpi_build_cmd(pm8001_ha, circularQ, opc, &payload,
4721+
sizeof(payload), 0);
47094722
}
47104723

47114724
static u32 pm80xx_chip_is_our_interrupt(struct pm8001_hba_info *pm8001_ha)
@@ -4763,7 +4776,8 @@ void mpi_set_phy_profile_req(struct pm8001_hba_info *pm8001_ha,
47634776
payload.reserved[j] = cpu_to_le32(*((u32 *)buf + i));
47644777
j++;
47654778
}
4766-
rc = pm8001_mpi_build_cmd(pm8001_ha, circularQ, opc, &payload, 0);
4779+
rc = pm8001_mpi_build_cmd(pm8001_ha, circularQ, opc, &payload,
4780+
sizeof(payload), 0);
47674781
if (rc)
47684782
pm8001_tag_free(pm8001_ha, tag);
47694783
}
@@ -4805,7 +4819,8 @@ void pm8001_set_phy_profile_single(struct pm8001_hba_info *pm8001_ha,
48054819
for (i = 0; i < length; i++)
48064820
payload.reserved[i] = cpu_to_le32(*(buf + i));
48074821

4808-
rc = pm8001_mpi_build_cmd(pm8001_ha, circularQ, opc, &payload, 0);
4822+
rc = pm8001_mpi_build_cmd(pm8001_ha, circularQ, opc, &payload,
4823+
sizeof(payload), 0);
48094824
if (rc)
48104825
pm8001_tag_free(pm8001_ha, tag);
48114826

0 commit comments

Comments
 (0)