powerpc: mark more local variables as volatile
authorArnd Bergmann <arnd@arndb.de>
Wed, 9 Aug 2023 13:10:08 +0000 (15:10 +0200)
committerMichael Ellerman <mpe@ellerman.id.au>
Mon, 14 Aug 2023 11:54:04 +0000 (21:54 +1000)
A while ago I created a2305e3de8193 ("powerpc: mark local variables
around longjmp as volatile") in order to allow building powerpc with
-Wextra enabled on gcc-11.

I tried this again with gcc-13 and found two more of the same issues,
presumably based on slightly different optimization paths being taken
here:

arch/powerpc/xmon/xmon.c:3306:27: error: variable 'mm' might be clobbered by 'longjmp' or 'vfork' [-Werror=clobbered]
arch/powerpc/kexec/crash.c:353:22: error: variable 'i' might be clobbered by 'longjmp' or 'vfork' [-Werror=clobbered]

I checked a bunch of randconfigs and found only these two, so just
address them the same way as the others.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://msgid.link/20230809131024.2039647-1-arnd@kernel.org
arch/powerpc/kexec/crash.c
arch/powerpc/xmon/xmon.c

index 252724e..ef5c2d2 100644 (file)
@@ -350,7 +350,7 @@ EXPORT_SYMBOL(crash_shutdown_unregister);
 
 void default_machine_crash_shutdown(struct pt_regs *regs)
 {
-       unsigned int i;
+       volatile unsigned int i;
        int (*old_handler)(struct pt_regs *regs);
 
        if (TRAP(regs) == INTERRUPT_SYSTEM_RESET)
index fae747c..0f3f93c 100644 (file)
@@ -3303,7 +3303,7 @@ static void show_pte(unsigned long addr)
 {
        unsigned long tskv = 0;
        struct task_struct *volatile tsk = NULL;
-       struct mm_struct *mm;
+       struct mm_struct *volatile mm;
        pgd_t *pgdp;
        p4d_t *p4dp;
        pud_t *pudp;