This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Commit: RX SIM: Obvious fix for valid register check
- From: Nick Clifton <nickc at redhat dot com>
- To: dj at redhat dot com
- Cc: gdb-patches at sourceware dot org
- Date: Fri, 24 Apr 2015 15:30:38 +0100
- Subject: Commit: RX SIM: Obvious fix for valid register check
- Authentication-results: sourceware.org; auth=none
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.
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 ();