Patch "powerpc/xmon: Fix -Wswitch-unreachable warning in bpt_cmds" has been added to the 5.15-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    powerpc/xmon: Fix -Wswitch-unreachable warning in bpt_cmds

to the 5.15-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     powerpc-xmon-fix-wswitch-unreachable-warning-in-bpt_.patch
and it can be found in the queue-5.15 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit ddaf01390955e85a6fed9770f17b37522424b246
Author: Gustavo A. R. Silva <gustavoars@xxxxxxxxxx>
Date:   Fri Sep 16 15:15:04 2022 +0100

    powerpc/xmon: Fix -Wswitch-unreachable warning in bpt_cmds
    
    [ Upstream commit 1c4a4a4c8410be4a231a58b23e7a30923ff954ac ]
    
    When building with automatic stack variable initialization, GCC 12
    complains about variables defined outside of switch case statements.
    Move the variable into the case that uses it, which silences the warning:
    
    arch/powerpc/xmon/xmon.c: In function ‘bpt_cmds’:
    arch/powerpc/xmon/xmon.c:1529:13: warning: statement will never be executed [-Wswitch-unreachable]
     1529 |         int mode;
          |             ^~~~
    
    Fixes: 09b6c1129f89 ("powerpc/xmon: Fix compile error with PPC_8xx=y")
    Signed-off-by: Gustavo A. R. Silva <gustavoars@xxxxxxxxxx>
    Reviewed-by: Kees Cook <keescook@xxxxxxxxxxxx>
    Signed-off-by: Michael Ellerman <mpe@xxxxxxxxxxxxxx>
    Link: https://lore.kernel.org/r/YySE6FHiOcbWWR+9@work
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/arch/powerpc/xmon/xmon.c b/arch/powerpc/xmon/xmon.c
index 8b28ff9d98d1..3c085e1e5232 100644
--- a/arch/powerpc/xmon/xmon.c
+++ b/arch/powerpc/xmon/xmon.c
@@ -1528,9 +1528,9 @@ bpt_cmds(void)
 	cmd = inchar();
 
 	switch (cmd) {
-	static const char badaddr[] = "Only kernel addresses are permitted for breakpoints\n";
-	int mode;
-	case 'd':	/* bd - hardware data breakpoint */
+	case 'd': {	/* bd - hardware data breakpoint */
+		static const char badaddr[] = "Only kernel addresses are permitted for breakpoints\n";
+		int mode;
 		if (xmon_is_ro) {
 			printf(xmon_ro_msg);
 			break;
@@ -1563,6 +1563,7 @@ bpt_cmds(void)
 
 		force_enable_xmon();
 		break;
+	}
 
 	case 'i':	/* bi - hardware instr breakpoint */
 		if (xmon_is_ro) {



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux