Commit: RX SIM: Obvious fix for valid register check

Message ID 87mw1xegz5.fsf@redhat.com
State Committed
Headers

Commit Message

Nick Clifton April 24, 2015, 2:30 p.m. UTC
  Hi DJ,

  I am applying the patch below as an obvious fix for a typo in the
  valid register check in sim/rx/reg.c:put_reg().  This bug was reported
  in PR 18273 by running a static analyser over the sim sources.

Cheers
  Nick

sim/rx/ChangeLog
2015-04-24  Nick Clifton  <nickc@redhat.com>

	PR sim/18273
	* reg.c (put_reg): Fix check for valid register number.
  

Patch

diff --git a/sim/rx/reg.c b/sim/rx/reg.c
index 0fbd4c3..6effe4b 100644
--- a/sim/rx/reg.c
+++ b/sim/rx/reg.c
@@ -253,7 +253,7 @@  put_reg (int id, unsigned int v)
       }
 
     default:
-      if (id >= 1 || id <= 15)
+      if (id >= 1 && id <= 15)
 	regs.r[id] = v;
       else
 	abort ();