Linux cryptographic layer development
 help / color / mirror / Atom feed
* [PATCH][next] crypto: cavium: Fix inverted logic on timeout end check
@ 2024-10-18 17:03 Colin Ian King
  2024-10-18 17:45 ` Everest K.C.
  0 siblings, 1 reply; 2+ messages in thread
From: Colin Ian King @ 2024-10-18 17:03 UTC (permalink / raw)
  To: George Cherian, Herbert Xu, David S . Miller, David Daney,
	linux-crypto
  Cc: kernel-janitors, linux-kernel

Currently the timeout check will immediately break out of the
while loop because timeout-- is always true on the first
iteration because timeout was initialized to 100. The check
is inverted, it should exit when timeout is zero. Fix this
by adding the missing ! operator.

Fixes: 9e2c7d99941d ("crypto: cavium - Add Support for Octeon-tx CPT Engine")
Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
---
 drivers/crypto/cavium/cpt/cptpf_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/crypto/cavium/cpt/cptpf_main.c b/drivers/crypto/cavium/cpt/cptpf_main.c
index 6872ac344001..48f878460f41 100644
--- a/drivers/crypto/cavium/cpt/cptpf_main.c
+++ b/drivers/crypto/cavium/cpt/cptpf_main.c
@@ -44,7 +44,7 @@ static void cpt_disable_cores(struct cpt_device *cpt, u64 coremask,
 		dev_err(dev, "Cores still busy %llx", coremask);
 		grp = cpt_read_csr64(cpt->reg_base,
 				     CPTX_PF_EXEC_BUSY(0));
-		if (timeout--)
+		if (!timeout--)
 			break;
 
 		udelay(CSR_DELAY);
-- 
2.39.5


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH][next] crypto: cavium: Fix inverted logic on timeout end check
  2024-10-18 17:03 [PATCH][next] crypto: cavium: Fix inverted logic on timeout end check Colin Ian King
@ 2024-10-18 17:45 ` Everest K.C.
  0 siblings, 0 replies; 2+ messages in thread
From: Everest K.C. @ 2024-10-18 17:45 UTC (permalink / raw)
  To: Colin Ian King
  Cc: George Cherian, Herbert Xu, David S . Miller, David Daney,
	linux-crypto, kernel-janitors, linux-kernel

On Fri, Oct 18, 2024 at 11:04 AM Colin Ian King <colin.i.king@gmail.com> wrote:
>
> Currently the timeout check will immediately break out of the
> while loop because timeout-- is always true on the first
> iteration because timeout was initialized to 100. The check
> is inverted, it should exit when timeout is zero. Fix this
> by adding the missing ! operator.
>
> Fixes: 9e2c7d99941d ("crypto: cavium - Add Support for Octeon-tx CPT Engine")
> Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
> ---
>  drivers/crypto/cavium/cpt/cptpf_main.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/crypto/cavium/cpt/cptpf_main.c b/drivers/crypto/cavium/cpt/cptpf_main.c
> index 6872ac344001..48f878460f41 100644
> --- a/drivers/crypto/cavium/cpt/cptpf_main.c
> +++ b/drivers/crypto/cavium/cpt/cptpf_main.c
> @@ -44,7 +44,7 @@ static void cpt_disable_cores(struct cpt_device *cpt, u64 coremask,
>                 dev_err(dev, "Cores still busy %llx", coremask);
>                 grp = cpt_read_csr64(cpt->reg_base,
>                                      CPTX_PF_EXEC_BUSY(0));
> -               if (timeout--)
> +               if (!timeout--)
>                         break;
>
>                 udelay(CSR_DELAY);
> --
> 2.39.5
>
>
This bug was recently fixed by my patch:
https://lore.kernel.org/all/20241018162311.4770-1-everestkc@everestkc.com.np/

Thanks,
Everest K.C.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-10-18 17:45 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-18 17:03 [PATCH][next] crypto: cavium: Fix inverted logic on timeout end check Colin Ian King
2024-10-18 17:45 ` Everest K.C.

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox