scsi: hisi_sas: Check before using pointer variables
authorYihang Li <liyihang9@huawei.com>
Thu, 14 Dec 2023 03:45:14 +0000 (11:45 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 25 Jan 2024 23:35:26 +0000 (15:35 -0800)
commit9e1986cd8a939ca27e3f765ebbf65e2af44bc9d9
tree5bf69cccf3a47a0a3c873c72d599fec4e8e06762
parentec2499b80e1cab5a856ae1eee9814bc2573df4cf
scsi: hisi_sas: Check before using pointer variables

[ Upstream commit 8dd10296be8562a45c6c6794dd492a2b7dccede8 ]

In commit 4b329abc9180 ("scsi: hisi_sas: Move slot variable definition in
hisi_sas_abort_task()"), we move the variables slot to the function head.
However, the variable slot may be NULL, we should check it in each branch.

Fixes: 4b329abc9180 ("scsi: hisi_sas: Move slot variable definition in hisi_sas_abort_task()")
Signed-off-by: Yihang Li <liyihang9@huawei.com>
Signed-off-by: Xiang Chen <chenxiang66@hisilicon.com>
Link: https://lore.kernel.org/r/1702525516-51258-4-git-send-email-chenxiang66@hisilicon.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/scsi/hisi_sas/hisi_sas_main.c