From: Mike Frysinger Date: Thu, 18 Jun 2015 08:02:26 +0000 (-0400) Subject: sim: callback: fix sentinel testing when walking maps X-Git-Tag: users/hjl/linux/release/2.25.51.0.3~1^2~5^2~46 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=7aec3bb968de6847cc73809408dfe8aa78fe7de7;p=platform%2Fupstream%2Fbinutils.git 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. --- diff --git a/sim/common/ChangeLog b/sim/common/ChangeLog index 59d92f4ea12..afc1b3aad5b 100644 --- a/sim/common/ChangeLog +++ b/sim/common/ChangeLog @@ -1,3 +1,8 @@ +2015-06-18 Mike Frysinger + + * callback.c (cb_target_map_entry, cb_host_map_entry): Change map to + m for sentinel testing. + 2015-06-17 Mike Frysinger * sim-syscall.c: Include errno.h and targ-vals.h. diff --git a/sim/common/callback.c b/sim/common/callback.c index 9b42536c5bf..486f1829fd2 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;