From 3b66533b37b1fcb330a545227984dff586b0a7ff Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Sat, 19 Feb 2011 06:13:35 +0000 Subject: [PATCH] verify the part is a Blackfin before we try using the bfin command on it and segfaulting git-svn-id: https://urjtag.svn.sourceforge.net/svnroot/urjtag/trunk@1884 b68d4a1b-bc3d-0410-92ed-d4ac073336b7 --- urjtag/ChangeLog | 5 +++++ urjtag/src/cmd/cmd_bfin.c | 6 ++++++ 2 files changed, 11 insertions(+) diff --git a/urjtag/ChangeLog b/urjtag/ChangeLog index e0a39e06..4c3be4ec 100644 --- a/urjtag/ChangeLog +++ b/urjtag/ChangeLog @@ -1,3 +1,8 @@ +2011-02-19 Mike Frysinger + + * src/cmd/cmd_bfin.c (cmd_bfin_run): Make sure the part is a Blackfin before + we try calling functions that don't exist and segfault. + 2011-02-18 Mike Frysinger * src/bfin/bfin-part.c (_bfin_part_init): Add missing "void" to param list. diff --git a/urjtag/src/cmd/cmd_bfin.c b/urjtag/src/cmd/cmd_bfin.c index 15b67d17..f5cb15bc 100644 --- a/urjtag/src/cmd/cmd_bfin.c +++ b/urjtag/src/cmd/cmd_bfin.c @@ -70,6 +70,12 @@ cmd_bfin_run (urj_chain_t *chain, char *params[]) return URJ_STATUS_FAIL; } + if (!part_is_bfin (chain, chain->active_part)) + { + urj_error_set (URJ_ERROR_ILLEGAL_STATE, "not a Blackfin part"); + return URJ_STATUS_FAIL; + } + assert (chain->active_part >= 0 && chain->active_part < chain->parts->len); if (strcmp (params[1], "emulation") == 0)