diff mbox series

powerpc/8xx: Fix warning in hw_breakpoint_handler()

Message ID 20221024041346.103608-1-ruscur@russell.cc (mailing list archive)
State Accepted
Commit f668027521561d1071ccf54500c82a58a1918b2b
Headers show
Series powerpc/8xx: Fix warning in hw_breakpoint_handler() | expand

Checks

Context Check Description
snowpatch_ozlabs/github-powerpc_ppctests success Successfully ran 10 jobs.
snowpatch_ozlabs/github-powerpc_selftests success Successfully ran 10 jobs.
snowpatch_ozlabs/github-powerpc_kernel_qemu success Successfully ran 23 jobs.
snowpatch_ozlabs/github-powerpc_clang success Successfully ran 6 jobs.
snowpatch_ozlabs/github-powerpc_sparse success Successfully ran 4 jobs.

Commit Message

Russell Currey Oct. 24, 2022, 4:13 a.m. UTC
In hw_breakpoint_handler(), ea is set by wp_get_instr_detail() except
for 8xx, leading the variable to be passed uninitialised to
wp_check_constraints().  This is safe as wp_check_constraints() returns
early without using ea, so just set it to make the compiler happy.

Signed-off-by: Russell Currey <ruscur@russell.cc>
---
 arch/powerpc/kernel/hw_breakpoint.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Christophe Leroy Nov. 3, 2022, 7:47 a.m. UTC | #1
Le 24/10/2022 à 06:13, Russell Currey a écrit :
> In hw_breakpoint_handler(), ea is set by wp_get_instr_detail() except
> for 8xx, leading the variable to be passed uninitialised to
> wp_check_constraints().  This is safe as wp_check_constraints() returns
> early without using ea, so just set it to make the compiler happy.
> 
> Signed-off-by: Russell Currey <ruscur@russell.cc>

Reviewed-by: Christophe Leroy <christophe.leroy@csgroup.eu>

> ---
>   arch/powerpc/kernel/hw_breakpoint.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/powerpc/kernel/hw_breakpoint.c b/arch/powerpc/kernel/hw_breakpoint.c
> index 8db1a15d7acb..e1b4e70c8fd0 100644
> --- a/arch/powerpc/kernel/hw_breakpoint.c
> +++ b/arch/powerpc/kernel/hw_breakpoint.c
> @@ -646,7 +646,7 @@ int hw_breakpoint_handler(struct die_args *args)
>   	ppc_inst_t instr = ppc_inst(0);
>   	int type = 0;
>   	int size = 0;
> -	unsigned long ea;
> +	unsigned long ea = 0;
>   
>   	/* Disable breakpoints during exception handling */
>   	hw_breakpoint_disable();
Michael Ellerman Nov. 30, 2022, 9:24 a.m. UTC | #2
On Mon, 24 Oct 2022 15:13:46 +1100, Russell Currey wrote:
> In hw_breakpoint_handler(), ea is set by wp_get_instr_detail() except
> for 8xx, leading the variable to be passed uninitialised to
> wp_check_constraints().  This is safe as wp_check_constraints() returns
> early without using ea, so just set it to make the compiler happy.
> 
> 

Applied to powerpc/next.

[1/1] powerpc/8xx: Fix warning in hw_breakpoint_handler()
      https://git.kernel.org/powerpc/c/f668027521561d1071ccf54500c82a58a1918b2b

cheers
diff mbox series

Patch

diff --git a/arch/powerpc/kernel/hw_breakpoint.c b/arch/powerpc/kernel/hw_breakpoint.c
index 8db1a15d7acb..e1b4e70c8fd0 100644
--- a/arch/powerpc/kernel/hw_breakpoint.c
+++ b/arch/powerpc/kernel/hw_breakpoint.c
@@ -646,7 +646,7 @@  int hw_breakpoint_handler(struct die_args *args)
 	ppc_inst_t instr = ppc_inst(0);
 	int type = 0;
 	int size = 0;
-	unsigned long ea;
+	unsigned long ea = 0;
 
 	/* Disable breakpoints during exception handling */
 	hw_breakpoint_disable();