* [bug report] scsi: hisi_sas: Fix some issues related to asd_sas_port->phy_list
@ 2022-01-10 12:54 Dan Carpenter
2022-01-10 16:35 ` John Garry
0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2022-01-10 12:54 UTC (permalink / raw)
To: chenxiang66; +Cc: linux-scsi
Hello Xiang Chen,
The patch 29e2bac87421: "scsi: hisi_sas: Fix some issues related to
asd_sas_port->phy_list" from Dec 20, 2021, leads to the following
Smatch static checker warning:
drivers/scsi/hisi_sas/hisi_sas_main.c:1536 hisi_sas_send_ata_reset_each_phy()
error: potentially dereferencing uninitialized 'sas_phy'.
drivers/scsi/hisi_sas/hisi_sas_main.c
1519 static void hisi_sas_send_ata_reset_each_phy(struct hisi_hba *hisi_hba,
1520 struct asd_sas_port *sas_port,
1521 struct domain_device *device)
1522 {
1523 struct hisi_sas_tmf_task tmf_task = { .force_phy = 1 };
1524 struct ata_port *ap = device->sata_dev.ap;
1525 struct device *dev = hisi_hba->dev;
1526 int s = sizeof(struct host_to_dev_fis);
1527 int rc = TMF_RESP_FUNC_FAILED;
1528 struct asd_sas_phy *sas_phy;
1529 struct ata_link *link;
1530 u8 fis[20] = {0};
1531 u32 state;
1532 int i;
1533
1534 state = hisi_hba->hw->get_phys_state(hisi_hba);
1535 for (i = 0; i < hisi_hba->n_phy; i++) {
--> 1536 if (!(state & BIT(sas_phy->id)))
^^^^^^^
This is no longer initialized anywhere.
1537 continue;
1538 if (!(sas_port->phy_mask & BIT(i)))
1539 continue;
1540
1541 ata_for_each_link(link, ap, EDGE) {
1542 int pmp = sata_srst_pmp(link);
1543
1544 tmf_task.phy_id = i;
1545 hisi_sas_fill_ata_reset_cmd(link->device, 1, pmp, fis);
1546 rc = hisi_sas_exec_internal_tmf_task(device, fis, s,
1547 &tmf_task);
1548 if (rc != TMF_RESP_FUNC_COMPLETE) {
1549 dev_err(dev, "phy%d ata reset failed rc=%d\n",
1550 i, rc);
1551 break;
1552 }
1553 }
1554 }
1555 }
regards,
dan carpenter
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [bug report] scsi: hisi_sas: Fix some issues related to asd_sas_port->phy_list
2022-01-10 12:54 [bug report] scsi: hisi_sas: Fix some issues related to asd_sas_port->phy_list Dan Carpenter
@ 2022-01-10 16:35 ` John Garry
0 siblings, 0 replies; 2+ messages in thread
From: John Garry @ 2022-01-10 16:35 UTC (permalink / raw)
To: Dan Carpenter, chenxiang66; +Cc: linux-scsi
On 10/01/2022 12:54, Dan Carpenter wrote:
> Hello Xiang Chen,
>
> The patch 29e2bac87421: "scsi: hisi_sas: Fix some issues related to
> asd_sas_port->phy_list" from Dec 20, 2021, leads to the following
> Smatch static checker warning:
>
> drivers/scsi/hisi_sas/hisi_sas_main.c:1536 hisi_sas_send_ata_reset_each_phy()
> error: potentially dereferencing uninitialized 'sas_phy'.
Hi Dan,
Thanks for the notice. This should now be fixed on Martin's 5.17 staging
branch.
https://git.kernel.org/pub/scm/linux/kernel/git/mkp/scsi.git/commit/?h=5.17/scsi-staging&id=5d9224fb076e9a2023e0b06d6a164d644612c0c0
Thanks!
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-01-10 16:36 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-01-10 12:54 [bug report] scsi: hisi_sas: Fix some issues related to asd_sas_port->phy_list Dan Carpenter
2022-01-10 16:35 ` John Garry
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).