Skip to contentSkip to conversation

parisc: Avoid zeroing register 0 in fixup_exception()

PATCH New Helge Deller 1 participant 1 message Jun 8, 2017 PA-RISC architecture

lore
Share & tools
lore

Helge Deller

author maintainer
#0 lore raw

PATCH 1/1 parisc: Avoid zeroing register 0 in fixup_exception()

Register gr[0] holds the PSW in interrupt context. It's absolutely unlikely that the compiler will use register zero in a get_user() call, but better BUG on such a case in fixup_exception() anyway.

arch/parisc/mm/fault.c +1 -0
index 32ec221..e683b7f 100644
@@ -163,6 +163,7 @@ int fixup_exception(struct pt_regs *regs)
 			/* zero target register for get_user() */
 			if (parisc_acctyp(0, regs->iir) == VM_READ) {
 				int treg = regs->iir & 0x1f;
+				BUG_ON(treg == 0);
 				regs->gr[treg] = 0;
 			}
 		}