Fixed omission of if curly brackets causing stack corruption.

Initialization a local pointer variable was only done in some conditions
causing the uninitialized pointer to corrupt kernel stack of current.
This commit is contained in:
Bahadir Balban
2009-05-25 12:12:21 +03:00
parent 5ac5889a0f
commit bece68fbf7
3 changed files with 5 additions and 3 deletions

View File

@@ -139,9 +139,10 @@ int ipc_msg_copy(struct ktcb *to, struct ktcb *from, unsigned int flags)
}
/* Save the sender id in case of ANYTHREAD receiver */
if (to->expected_sender == L4_ANYTHREAD)
if (to->expected_sender == L4_ANYTHREAD) {
mr0_dst = KTCB_REF_MR0(to);
mr0_dst[MR_SENDER] = from->tid;
}
return ret;
}

View File

@@ -3,7 +3,7 @@
#define __TASKNAME__ "test0"
#define TEST_VERBOSE_PRINT
//#define TEST_VERBOSE_PRINT
#if defined (TEST_VERBOSE_PRINT)
#define test_printf(...) printf(__VA_ARGS__)
#else

View File

@@ -17,10 +17,11 @@ int forktest(void)
/* 16 forks */
for (int i = 0; i < 4; i++)
for (int i = 0; i < 4; i++) {
test_printf("%d: Forking...\n", getpid());
if (fork() < 0)
goto out_err;
}
myid = getpid();