Skip to contentSkip to conversation

powerpc/8xx: Fix warning in hw_breakpoint_handler()

PATCH Applied Russell Currey 3 participants 3 messages Oct 24, 2022 – Nov 30, 2022 PowerPC

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 powerpc/8xx: Fix warning in hw_breakpoint_handler()

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.

---
 arch/powerpc/kernel/hw_breakpoint.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/powerpc/kernel/hw_breakpoint.c +1 -1
index 8db1a15d7acb..e1b4e70c8fd0 100644
@@ -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();
Signature · 1 line
2.37.3
Reviewed-by on v1 1/1
#1 lore raw

Le 24/10/2022 à 06:13, Russell Currey a écrit :

Quoted 6 lines

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.

Quoted 17 lines
---
  arch/powerpc/kernel/hw_breakpoint.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
arch/powerpc/kernel/hw_breakpoint.c +1 -1
index 8db1a15d7acb..e1b4e70c8fd0 100644
@@ -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();
#2 lore raw
In reply to Russell Currey
Quoted 6 lines · Russell Currey

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