aboutsummaryrefslogtreecommitdiff
path: root/src/rtos
diff options
context:
space:
mode:
authorSteven Stallion <stallion@squareup.com>2017-06-21 22:14:08 -0700
committerFreddie Chopin <freddie.chopin@gmail.com>2017-06-30 21:23:47 +0100
commit0e4fbfba03e7453846e75b2a54a8b8a6613dbb1e (patch)
tree87dcf06e56feca75a8eb8ffa80f5dbc67bf2f327 /src/rtos
parente6fe4dddb97835a60cc512fea977550d7ae4056f (diff)
downloadriscv-openocd-0e4fbfba03e7453846e75b2a54a8b8a6613dbb1e.zip
riscv-openocd-0e4fbfba03e7453846e75b2a54a8b8a6613dbb1e.tar.gz
riscv-openocd-0e4fbfba03e7453846e75b2a54a8b8a6613dbb1e.tar.bz2
rtos: better sanity checking for uCOS-III
This patch improves the OSRunning check. If the rtos_running check fails, update_threads will return an error rather than attempt to update the thread list using bad values. Change-Id: I8614c325504d3a9ab19aebb6862b1fe445a0c8e7 Signed-off-by: Steven Stallion <stallion@squareup.com> Reviewed-on: http://openocd.zylin.com/4166 Tested-by: jenkins Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Diffstat (limited to 'src/rtos')
-rw-r--r--src/rtos/uCOS-III.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/rtos/uCOS-III.c b/src/rtos/uCOS-III.c
index 9021167..0a0fb3e 100644
--- a/src/rtos/uCOS-III.c
+++ b/src/rtos/uCOS-III.c
@@ -300,6 +300,11 @@ static int uCOS_III_update_threads(struct rtos *rtos)
return retval;
}
+ if (rtos_running != 1 && rtos_running != 0) {
+ LOG_ERROR("uCOS-III: invalid RTOS running value");
+ return ERROR_FAIL;
+ }
+
if (!rtos_running) {
rtos->thread_details = calloc(1, sizeof(struct thread_detail));
if (rtos->thread_details == NULL) {