ARM7_9: Fix segfaults
authorAntonio Borneo <borneo.antonio@gmail.com>
Wed, 30 Dec 2009 23:13:16 +0000 (07:13 +0800)
committerDavid Brownell <dbrownell@users.sourceforge.net>
Thu, 31 Dec 2009 00:58:27 +0000 (16:58 -0800)
Handlers for commands
 - arm7_9 semihosting <enable | disable>
 - $_TARGETNAME arp_reset assert 1
didn't check if target has already been examined, and could
segfault when using the NULL pointer "arm7_9->eice_cache".

Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
src/target/arm7_9_common.c
src/target/target.c

index e5969806148bc6dbe367d23b3338421ec4110125..a09b0ad99f0efa5fcf1c4a885d0ffb4e1400731b 100644 (file)
@@ -2797,6 +2797,12 @@ COMMAND_HANDLER(handle_arm7_9_semihosting_command)
 
                COMMAND_PARSE_ENABLE(CMD_ARGV[0], semihosting);
 
+               if (!target_was_examined(target))
+               {
+                       LOG_ERROR("Target not examined yet");
+                       return ERROR_FAIL;
+               }
+
                if (arm7_9->has_vector_catch) {
                        struct reg *vector_catch = &arm7_9->eice_cache
                                        ->reg_list[EICE_VEC_CATCH];
index 8cb53b36dfc6c4667271bf360ea037e51dadb9ee..d3d1beee08bd00a181145252cf2c609cd7fb9f8e 100644 (file)
@@ -4079,6 +4079,11 @@ static int jim_target_reset(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
        struct target *target = Jim_CmdPrivData(goi.interp);
        if (!target->tap->enabled)
                return jim_target_tap_disabled(interp);
+       if (!(target_was_examined(target)))
+       {
+               LOG_ERROR("Target not examined yet");
+               return ERROR_TARGET_NOT_EXAMINED;
+       }
        if (!target->type->assert_reset || !target->type->deassert_reset)
        {
                Jim_SetResult_sprintf(interp,

Linking to existing account procedure

If you already have an account and want to add another login method you MUST first sign in with your existing account and then change URL to read https://review.openocd.org/login/?link to get to this page again but this time it'll work for linking. Thank you.

SSH host keys fingerprints

1024 SHA256:YKx8b7u5ZWdcbp7/4AeXNaqElP49m6QrwfXaqQGJAOk gerrit-code-review@openocd.zylin.com (DSA)
384 SHA256:jHIbSQa4REvwCFG4cq5LBlBLxmxSqelQPem/EXIrxjk gerrit-code-review@openocd.org (ECDSA)
521 SHA256:UAOPYkU9Fjtcao0Ul/Rrlnj/OsQvt+pgdYSZ4jOYdgs gerrit-code-review@openocd.org (ECDSA)
256 SHA256:A13M5QlnozFOvTllybRZH6vm7iSt0XLxbA48yfc2yfY gerrit-code-review@openocd.org (ECDSA)
256 SHA256:spYMBqEYoAOtK7yZBrcwE8ZpYt6b68Cfh9yEVetvbXg gerrit-code-review@openocd.org (ED25519)
+--[ED25519 256]--+
|=..              |
|+o..   .         |
|*.o   . .        |
|+B . . .         |
|Bo. = o S        |
|Oo.+ + =         |
|oB=.* = . o      |
| =+=.+   + E     |
|. .=o   . o      |
+----[SHA256]-----+
2048 SHA256:0Onrb7/PHjpo6iVZ7xQX2riKN83FJ3KGU0TvI0TaFG4 gerrit-code-review@openocd.zylin.com (RSA)