aboutsummaryrefslogtreecommitdiff
path: root/sim/common/callback.c
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2015-06-18 04:02:26 -0400
committerMike Frysinger <vapier@gentoo.org>2015-06-18 04:02:26 -0400
commit7aec3bb968de6847cc73809408dfe8aa78fe7de7 (patch)
tree2370ae15583dc1e5603edc019cf1c4cefb971bd0 /sim/common/callback.c
parentfaffbc648d247533b6cecfedbbaf2d640d72cad2 (diff)
downloadbinutils-7aec3bb968de6847cc73809408dfe8aa78fe7de7.zip
binutils-7aec3bb968de6847cc73809408dfe8aa78fe7de7.tar.gz
binutils-7aec3bb968de6847cc73809408dfe8aa78fe7de7.tar.bz2
sim: callback: fix sentinel testing when walking maps
The new helpers for walking the maps tested the wrong value for exiting the for loop. This caused crashes when looking up entries that were not in the map.
Diffstat (limited to 'sim/common/callback.c')
-rw-r--r--sim/common/callback.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/sim/common/callback.c b/sim/common/callback.c
index 9b42536..486f182 100644
--- a/sim/common/callback.c
+++ b/sim/common/callback.c
@@ -803,7 +803,7 @@ cb_target_map_entry (const CB_TARGET_DEFS_MAP map[], int target_val)
{
const CB_TARGET_DEFS_MAP *m;
- for (m = &map[0]; map->target_val != -1; ++m)
+ for (m = &map[0]; m->target_val != -1; ++m)
if (m->target_val == target_val)
return m;
@@ -815,7 +815,7 @@ cb_host_map_entry (const CB_TARGET_DEFS_MAP map[], int host_val)
{
const CB_TARGET_DEFS_MAP *m;
- for (m = &map[0]; map->host_val != -1; ++m)
+ for (m = &map[0]; m->host_val != -1; ++m)
if (m->host_val == host_val)
return m;