Skip to content

Commit

Permalink
core: thread: Added stack size validation
Browse files Browse the repository at this point in the history
  • Loading branch information
IldarValiev committed Mar 7, 2016
1 parent bad2b5c commit 4f5bea7
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions core/thread.c
Expand Up @@ -146,6 +146,9 @@ kernel_pid_t thread_create(char *stack, int stacksize, char priority, int flags,
/* round down the stacksize to a multiple of thread_t alignments (usually 16/32bit) */
stacksize -= stacksize % ALIGN_OF(thread_t);

if (stacksize < 0) {
DEBUG("thread_create: stacksize is too small!\n");
}
/* allocate our thread control block at the top of our stackspace */
thread_t *cb = (thread_t *) (stack + stacksize);

Expand Down

0 comments on commit 4f5bea7

Please sign in to comment.