Fix data corruption issue.
authorDavid Given <dg@cowlark.com>
Sat, 23 Jan 2016 23:51:29 +0000 (00:51 +0100)
committerDavid Given <dg@cowlark.com>
Sat, 23 Jan 2016 23:51:29 +0000 (00:51 +0100)
Kernel/include/kernel.h
Kernel/syscall_proc.c

index 84af6d4..0c4d175 100644 (file)
@@ -381,7 +381,8 @@ typedef struct p_tab {
 #ifdef udata
     struct u_data *p_udata;    /* Udata pointer for platforms using dynamic udata */
 #endif
-    /* Everything below here is overlaid by time info at exit */
+    /* Everything below here is overlaid by time info at exit.
+        * Make sure it's 32-bit aligned. */
     uint16_t    p_priority;     /* Process priority */
     uint32_t    p_pending;      /* Bitmask of pending signals */
     uint32_t    p_ignored;      /* Bitmask of ignored signals */
index 213d317..ff900ee 100644 (file)
@@ -315,8 +315,8 @@ arg_t _waitpid(void)
 
                                        /* Add in child's time info.  It was stored on top */
                                        /* of p_priority in the childs process table entry. */
-                                       udata.u_cutime += ((clock_t *)p->p_priority)[0];
-                                       udata.u_cstime += ((clock_t *)p->p_priority)[1];
+                                       udata.u_cutime += ((clock_t *)&p->p_priority)[0];
+                                       udata.u_cstime += ((clock_t *)&p->p_priority)[1];
                                        return retval;
                                }
                        }