sim: callback: fix sentinel testing when walking maps
authorMike Frysinger <vapier@gentoo.org>
Thu, 18 Jun 2015 08:02:26 +0000 (04:02 -0400)
committerMike Frysinger <vapier@gentoo.org>
Thu, 18 Jun 2015 08:02:26 +0000 (04:02 -0400)
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.

sim/common/ChangeLog
sim/common/callback.c

index 59d92f4ea1279c8b2be4589fcbe99927751a05db..afc1b3aad5b0071a5ab1408d2adfc21e22183105 100644 (file)
@@ -1,3 +1,8 @@
+2015-06-18  Mike Frysinger  <vapier@gentoo.org>
+
+       * callback.c (cb_target_map_entry, cb_host_map_entry): Change map to
+       m for sentinel testing.
+
 2015-06-17  Mike Frysinger  <vapier@gentoo.org>
 
        * sim-syscall.c: Include errno.h and targ-vals.h.
index 9b42536c5bf86ce425ca7ba7aa9ba27152c3d3e8..486f1829fd2ab7a58e664936a92a05e7da355e66 100644 (file)
@@ -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;
 
This page took 0.031406 seconds and 4 git commands to generate.