[rtems commit] timecounter: Avoid invalid memcpy()

Sebastian Huber sebh at rtems.org
Wed Mar 16 12:35:52 UTC 2016


Module:    rtems
Branch:    master
Commit:    4bf79afb665bfd9b71c49088afaf655b82186522
Changeset: http://git.rtems.org/rtems/commit/?id=4bf79afb665bfd9b71c49088afaf655b82186522

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Wed Mar 16 10:28:03 2016 +0100

timecounter: Avoid invalid memcpy()

In uni-processor configurations we have only one timehand.  Do not issue
a memcpy() with equal source and destination.

---

 cpukit/score/src/kern_tc.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/cpukit/score/src/kern_tc.c b/cpukit/score/src/kern_tc.c
index 316a16f..bd6ab04 100644
--- a/cpukit/score/src/kern_tc.c
+++ b/cpukit/score/src/kern_tc.c
@@ -1411,10 +1411,16 @@ tc_windup(void)
 	 * the contents, the generation must be zero.
 	 */
 	tho = timehands;
+#if defined(RTEMS_SMP)
 	th = tho->th_next;
+#else
+	th = tho;
+#endif
 	ogen = th->th_generation;
 	tc_setgen(th, 0);
+#if defined(RTEMS_SMP)
 	bcopy(tho, th, offsetof(struct timehands, th_generation));
+#endif
 
 	/*
 	 * Capture a timecounter delta on the current timecounter and if
@@ -1552,7 +1558,9 @@ tc_windup(void)
 	}
 #endif
 
+#if defined(RTEMS_SMP)
 	timehands = th;
+#endif
 #ifndef __rtems__
 	timekeep_push_vdso();
 #endif /* __rtems__ */




More information about the vc mailing list