2022-10-26 10:46:13

by John Garry

[permalink] [raw]
Subject: [PATCH] scsi: pm8001: Drop !task check in pm8001_abort_task()

In commit 0b639decf651 ("scsi: pm8001: Modify task abort handling for SATA
task"), code was introduced to dereference "task" pointer in
pm8001_abort_task(). However there was a pre-existing later check for
"!task", which spooked the kernel test robot.

Function pm8001_abort_task() should never be passed NULL for "task"
pointer, so remove that check. Also remove the "unlikely" hint, as this is
not fastpath code.

Reported-by: kernel test robot <[email protected]>
Reported-by: Dan Carpenter <[email protected]>
Signed-off-by: John Garry <[email protected]>

diff --git a/drivers/scsi/pm8001/pm8001_sas.c b/drivers/scsi/pm8001/pm8001_sas.c
index 2359e827c9e6..e5673c774f66 100644
--- a/drivers/scsi/pm8001/pm8001_sas.c
+++ b/drivers/scsi/pm8001/pm8001_sas.c
@@ -979,7 +979,7 @@ int pm8001_abort_task(struct sas_task *task)
u32 phy_id, port_id;
struct sas_task_slow slow_task;

- if (unlikely(!task || !task->lldd_task || !task->dev))
+ if (!task->lldd_task || !task->dev)
return TMF_RESP_FUNC_FAILED;

dev = task->dev;
--
2.25.1



2022-10-26 10:50:01

by Jinpu Wang

[permalink] [raw]
Subject: Re: [PATCH] scsi: pm8001: Drop !task check in pm8001_abort_task()

On Wed, Oct 26, 2022 at 12:25 PM John Garry <[email protected]> wrote:
>
> In commit 0b639decf651 ("scsi: pm8001: Modify task abort handling for SATA
> task"), code was introduced to dereference "task" pointer in
> pm8001_abort_task(). However there was a pre-existing later check for
> "!task", which spooked the kernel test robot.
>
> Function pm8001_abort_task() should never be passed NULL for "task"
> pointer, so remove that check. Also remove the "unlikely" hint, as this is
> not fastpath code.
>
> Reported-by: kernel test robot <[email protected]>
> Reported-by: Dan Carpenter <[email protected]>
> Signed-off-by: John Garry <[email protected]>
Acked-by: Jack Wang <[email protected]>
>
> diff --git a/drivers/scsi/pm8001/pm8001_sas.c b/drivers/scsi/pm8001/pm8001_sas.c
> index 2359e827c9e6..e5673c774f66 100644
> --- a/drivers/scsi/pm8001/pm8001_sas.c
> +++ b/drivers/scsi/pm8001/pm8001_sas.c
> @@ -979,7 +979,7 @@ int pm8001_abort_task(struct sas_task *task)
> u32 phy_id, port_id;
> struct sas_task_slow slow_task;
>
> - if (unlikely(!task || !task->lldd_task || !task->dev))
> + if (!task->lldd_task || !task->dev)
> return TMF_RESP_FUNC_FAILED;
>
> dev = task->dev;
> --
> 2.25.1
>

2022-10-27 00:52:00

by Damien Le Moal

[permalink] [raw]
Subject: Re: [PATCH] scsi: pm8001: Drop !task check in pm8001_abort_task()

On 10/26/22 19:56, John Garry wrote:
> In commit 0b639decf651 ("scsi: pm8001: Modify task abort handling for SATA
> task"), code was introduced to dereference "task" pointer in
> pm8001_abort_task(). However there was a pre-existing later check for
> "!task", which spooked the kernel test robot.
>
> Function pm8001_abort_task() should never be passed NULL for "task"
> pointer, so remove that check. Also remove the "unlikely" hint, as this is
> not fastpath code.
>
> Reported-by: kernel test robot <[email protected]>
> Reported-by: Dan Carpenter <[email protected]>
> Signed-off-by: John Garry <[email protected]>
>
> diff --git a/drivers/scsi/pm8001/pm8001_sas.c b/drivers/scsi/pm8001/pm8001_sas.c
> index 2359e827c9e6..e5673c774f66 100644
> --- a/drivers/scsi/pm8001/pm8001_sas.c
> +++ b/drivers/scsi/pm8001/pm8001_sas.c
> @@ -979,7 +979,7 @@ int pm8001_abort_task(struct sas_task *task)
> u32 phy_id, port_id;
> struct sas_task_slow slow_task;
>
> - if (unlikely(!task || !task->lldd_task || !task->dev))
> + if (!task->lldd_task || !task->dev)
> return TMF_RESP_FUNC_FAILED;
>
> dev = task->dev;

Reviewed-by: Damien Le Moal <[email protected]>

--
Damien Le Moal
Western Digital Research


2022-10-27 02:40:37

by Martin K. Petersen

[permalink] [raw]
Subject: Re: [PATCH] scsi: pm8001: Drop !task check in pm8001_abort_task()


John,

> In commit 0b639decf651 ("scsi: pm8001: Modify task abort handling for
> SATA task"), code was introduced to dereference "task" pointer in
> pm8001_abort_task(). However there was a pre-existing later check for
> "!task", which spooked the kernel test robot.
>
> Function pm8001_abort_task() should never be passed NULL for "task"
> pointer, so remove that check. Also remove the "unlikely" hint, as
> this is not fastpath code.

Applied to 6.2/scsi-staging, thanks!

--
Martin K. Petersen Oracle Linux Engineering

2022-11-08 04:28:57

by Martin K. Petersen

[permalink] [raw]
Subject: Re: [PATCH] scsi: pm8001: Drop !task check in pm8001_abort_task()

On Wed, 26 Oct 2022 18:56:04 +0800, John Garry wrote:

> In commit 0b639decf651 ("scsi: pm8001: Modify task abort handling for SATA
> task"), code was introduced to dereference "task" pointer in
> pm8001_abort_task(). However there was a pre-existing later check for
> "!task", which spooked the kernel test robot.
>
> Function pm8001_abort_task() should never be passed NULL for "task"
> pointer, so remove that check. Also remove the "unlikely" hint, as this is
> not fastpath code.
>
> [...]

Applied to 6.2/scsi-queue, thanks!

[1/1] scsi: pm8001: Drop !task check in pm8001_abort_task()
https://git.kernel.org/mkp/scsi/c/4481bdc677c1

--
Martin K. Petersen Oracle Linux Engineering