summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGrissiom <[email protected]>2013-10-11 17:23:30 +0800
committerGrissiom <[email protected]>2013-10-11 17:23:30 +0800
commitd0251a523a58390dd16305611b59b4b96f29ff3e (patch)
treec55a72a7b400b12f7797b9f6ef9b00a48d423049
parent786a5541a3cdcc419c349943ee717f680cb87ec8 (diff)
log_trace: fix the memmove use
The first parameter of memmove is the dst, not src. Besides, fix the wrong move size.
-rw-r--r--components/utilities/logtrace/log_trace.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/components/utilities/logtrace/log_trace.c b/components/utilities/logtrace/log_trace.c
index cc55b1dd44..1d0a42725e 100644
--- a/components/utilities/logtrace/log_trace.c
+++ b/components/utilities/logtrace/log_trace.c
@@ -93,6 +93,9 @@ static struct log_trace_session* _lg_lookup_session(log_trace_idnum_t num)
last = _the_sess_nr;
do {
unsigned int i = (first + last)/2;
+
+ RT_ASSERT(_the_sessions[i]);
+
if (_the_sessions[i]->id.num == num)
{
/* there is no need to protect the _cache because write a pointer
@@ -135,7 +138,8 @@ rt_err_t log_trace_register_session(struct log_trace_session *session)
{
if (_the_sessions[i]->id.num > session->id.num)
{
- rt_memmove(_the_sessions+i, _the_sessions+i+1, _the_sess_nr-i);
+ rt_memmove(_the_sessions+i+1, _the_sessions+i,
+ (_the_sess_nr-i)*sizeof(&_the_sessions[0]));
_the_sessions[i] = session;
break;
}