All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] arm64: delete dead code in this_cpu_set_vectors()
@ 2023-04-19  7:58 ` Dan Carpenter
  0 siblings, 0 replies; 6+ messages in thread
From: Dan Carpenter @ 2023-04-19  7:58 UTC (permalink / raw)
  To: James Morse
  Cc: Will Deacon, Kristina Martsenko, Mark Rutland, Mark Brown,
	Ard Biesheuvel, Liu Song, D Scott Phillips, James Morse,
	linux-arm-kernel, linux-kernel, kernel-janitors

The "slot" variable is an enum, and in this context it is an unsigned
int.  So the type means it can never be negative and also we never pass
invalid data to this function.  If something did pass invalid data then
this check would be insufficient protection.

Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
---
 arch/arm64/kernel/proton-pack.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/arch/arm64/kernel/proton-pack.c b/arch/arm64/kernel/proton-pack.c
index fca9cc6f5581..05f40c4e18fd 100644
--- a/arch/arm64/kernel/proton-pack.c
+++ b/arch/arm64/kernel/proton-pack.c
@@ -966,9 +966,6 @@ static void this_cpu_set_vectors(enum arm64_bp_harden_el1_vectors slot)
 {
 	const char *v = arm64_get_bp_hardening_vector(slot);
 
-	if (slot < 0)
-		return;
-
 	__this_cpu_write(this_cpu_vector, v);
 
 	/*
-- 
2.39.2


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

* [PATCH] arm64: delete dead code in this_cpu_set_vectors()
@ 2023-04-19  7:58 ` Dan Carpenter
  0 siblings, 0 replies; 6+ messages in thread
From: Dan Carpenter @ 2023-04-19  7:58 UTC (permalink / raw)
  To: James Morse
  Cc: Will Deacon, Kristina Martsenko, Mark Rutland, Mark Brown,
	Ard Biesheuvel, Liu Song, D Scott Phillips, James Morse,
	linux-arm-kernel, linux-kernel, kernel-janitors

The "slot" variable is an enum, and in this context it is an unsigned
int.  So the type means it can never be negative and also we never pass
invalid data to this function.  If something did pass invalid data then
this check would be insufficient protection.

Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
---
 arch/arm64/kernel/proton-pack.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/arch/arm64/kernel/proton-pack.c b/arch/arm64/kernel/proton-pack.c
index fca9cc6f5581..05f40c4e18fd 100644
--- a/arch/arm64/kernel/proton-pack.c
+++ b/arch/arm64/kernel/proton-pack.c
@@ -966,9 +966,6 @@ static void this_cpu_set_vectors(enum arm64_bp_harden_el1_vectors slot)
 {
 	const char *v = arm64_get_bp_hardening_vector(slot);
 
-	if (slot < 0)
-		return;
-
 	__this_cpu_write(this_cpu_vector, v);
 
 	/*
-- 
2.39.2


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH] arm64: delete dead code in this_cpu_set_vectors()
  2023-04-19  7:58 ` Dan Carpenter
@ 2023-04-19 14:29   ` Ard Biesheuvel
  -1 siblings, 0 replies; 6+ messages in thread
From: Ard Biesheuvel @ 2023-04-19 14:29 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: James Morse, Will Deacon, Kristina Martsenko, Mark Rutland,
	Mark Brown, Liu Song, D Scott Phillips, linux-arm-kernel,
	linux-kernel, kernel-janitors

On Wed, 19 Apr 2023 at 09:58, Dan Carpenter <dan.carpenter@linaro.org> wrote:
>
> The "slot" variable is an enum, and in this context it is an unsigned
> int.  So the type means it can never be negative and also we never pass
> invalid data to this function.  If something did pass invalid data then
> this check would be insufficient protection.
>
> Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>

Acked-by: Ard Biesheuvel <ardb@kernel.org>

> ---
>  arch/arm64/kernel/proton-pack.c | 3 ---
>  1 file changed, 3 deletions(-)
>
> diff --git a/arch/arm64/kernel/proton-pack.c b/arch/arm64/kernel/proton-pack.c
> index fca9cc6f5581..05f40c4e18fd 100644
> --- a/arch/arm64/kernel/proton-pack.c
> +++ b/arch/arm64/kernel/proton-pack.c
> @@ -966,9 +966,6 @@ static void this_cpu_set_vectors(enum arm64_bp_harden_el1_vectors slot)
>  {
>         const char *v = arm64_get_bp_hardening_vector(slot);
>
> -       if (slot < 0)
> -               return;
> -
>         __this_cpu_write(this_cpu_vector, v);
>
>         /*
> --
> 2.39.2
>

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

* Re: [PATCH] arm64: delete dead code in this_cpu_set_vectors()
@ 2023-04-19 14:29   ` Ard Biesheuvel
  0 siblings, 0 replies; 6+ messages in thread
From: Ard Biesheuvel @ 2023-04-19 14:29 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: James Morse, Will Deacon, Kristina Martsenko, Mark Rutland,
	Mark Brown, Liu Song, D Scott Phillips, linux-arm-kernel,
	linux-kernel, kernel-janitors

On Wed, 19 Apr 2023 at 09:58, Dan Carpenter <dan.carpenter@linaro.org> wrote:
>
> The "slot" variable is an enum, and in this context it is an unsigned
> int.  So the type means it can never be negative and also we never pass
> invalid data to this function.  If something did pass invalid data then
> this check would be insufficient protection.
>
> Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>

Acked-by: Ard Biesheuvel <ardb@kernel.org>

> ---
>  arch/arm64/kernel/proton-pack.c | 3 ---
>  1 file changed, 3 deletions(-)
>
> diff --git a/arch/arm64/kernel/proton-pack.c b/arch/arm64/kernel/proton-pack.c
> index fca9cc6f5581..05f40c4e18fd 100644
> --- a/arch/arm64/kernel/proton-pack.c
> +++ b/arch/arm64/kernel/proton-pack.c
> @@ -966,9 +966,6 @@ static void this_cpu_set_vectors(enum arm64_bp_harden_el1_vectors slot)
>  {
>         const char *v = arm64_get_bp_hardening_vector(slot);
>
> -       if (slot < 0)
> -               return;
> -
>         __this_cpu_write(this_cpu_vector, v);
>
>         /*
> --
> 2.39.2
>

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH] arm64: delete dead code in this_cpu_set_vectors()
  2023-04-19  7:58 ` Dan Carpenter
@ 2023-04-20 17:04   ` Will Deacon
  -1 siblings, 0 replies; 6+ messages in thread
From: Will Deacon @ 2023-04-20 17:04 UTC (permalink / raw)
  To: Dan Carpenter, James Morse
  Cc: catalin.marinas, kernel-team, Will Deacon, Kristina Martsenko,
	Ard Biesheuvel, Liu Song, Mark Rutland, linux-kernel,
	kernel-janitors, D Scott Phillips, Mark Brown, linux-arm-kernel

On Wed, 19 Apr 2023 10:58:43 +0300, Dan Carpenter wrote:
> The "slot" variable is an enum, and in this context it is an unsigned
> int.  So the type means it can never be negative and also we never pass
> invalid data to this function.  If something did pass invalid data then
> this check would be insufficient protection.
> 
> 

Applied to arm64 (for-next/misc), thanks!

[1/1] arm64: delete dead code in this_cpu_set_vectors()
      https://git.kernel.org/arm64/c/460e70e2dc9a

Cheers,
-- 
Will

https://fixes.arm64.dev
https://next.arm64.dev
https://will.arm64.dev

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

* Re: [PATCH] arm64: delete dead code in this_cpu_set_vectors()
@ 2023-04-20 17:04   ` Will Deacon
  0 siblings, 0 replies; 6+ messages in thread
From: Will Deacon @ 2023-04-20 17:04 UTC (permalink / raw)
  To: Dan Carpenter, James Morse
  Cc: catalin.marinas, kernel-team, Will Deacon, Kristina Martsenko,
	Ard Biesheuvel, Liu Song, Mark Rutland, linux-kernel,
	kernel-janitors, D Scott Phillips, Mark Brown, linux-arm-kernel

On Wed, 19 Apr 2023 10:58:43 +0300, Dan Carpenter wrote:
> The "slot" variable is an enum, and in this context it is an unsigned
> int.  So the type means it can never be negative and also we never pass
> invalid data to this function.  If something did pass invalid data then
> this check would be insufficient protection.
> 
> 

Applied to arm64 (for-next/misc), thanks!

[1/1] arm64: delete dead code in this_cpu_set_vectors()
      https://git.kernel.org/arm64/c/460e70e2dc9a

Cheers,
-- 
Will

https://fixes.arm64.dev
https://next.arm64.dev
https://will.arm64.dev

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

end of thread, other threads:[~2023-04-20 17:05 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-19  7:58 [PATCH] arm64: delete dead code in this_cpu_set_vectors() Dan Carpenter
2023-04-19  7:58 ` Dan Carpenter
2023-04-19 14:29 ` Ard Biesheuvel
2023-04-19 14:29   ` Ard Biesheuvel
2023-04-20 17:04 ` Will Deacon
2023-04-20 17:04   ` Will Deacon

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.