kernel: don't use u32_t for data sizes

Use a size_t instead.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
This commit is contained in:
Andrew Boie 2019-11-21 17:38:17 -08:00 committed by Andrew Boie
commit b5c681071a
3 changed files with 9 additions and 9 deletions

View file

@ -4973,7 +4973,7 @@ extern void z_timer_expiration_handler(struct _timeout *t);
#define K_THREAD_STACK_LEN(size) ARCH_THREAD_STACK_LEN(size) #define K_THREAD_STACK_LEN(size) ARCH_THREAD_STACK_LEN(size)
#define K_THREAD_STACK_MEMBER(sym, size) ARCH_THREAD_STACK_MEMBER(sym, size) #define K_THREAD_STACK_MEMBER(sym, size) ARCH_THREAD_STACK_MEMBER(sym, size)
#define K_THREAD_STACK_SIZEOF(sym) ARCH_THREAD_STACK_SIZEOF(sym) #define K_THREAD_STACK_SIZEOF(sym) ARCH_THREAD_STACK_SIZEOF(sym)
#define K_THREAD_STACK_RESERVED ARCH_THREAD_STACK_RESERVED #define K_THREAD_STACK_RESERVED ((size_t)ARCH_THREAD_STACK_RESERVED)
static inline char *Z_THREAD_STACK_BUFFER(k_thread_stack_t *sym) static inline char *Z_THREAD_STACK_BUFFER(k_thread_stack_t *sym)
{ {
return ARCH_THREAD_STACK_BUFFER(sym); return ARCH_THREAD_STACK_BUFFER(sym);
@ -5082,7 +5082,7 @@ static inline char *Z_THREAD_STACK_BUFFER(k_thread_stack_t *sym)
* the stack object, and does not account for additional space used due to * the stack object, and does not account for additional space used due to
* enforce alignment. * enforce alignment.
*/ */
#define K_THREAD_STACK_RESERVED 0 #define K_THREAD_STACK_RESERVED ((size_t)0U)
/** /**
* @brief Get a pointer to the physical stack buffer * @brief Get a pointer to the physical stack buffer

View file

@ -599,7 +599,7 @@ k_tid_t z_vrfy_k_thread_create(struct k_thread *new_thread,
void *p1, void *p2, void *p3, void *p1, void *p2, void *p3,
int prio, u32_t options, s32_t delay) int prio, u32_t options, s32_t delay)
{ {
u32_t total_size; size_t total_size;
struct _k_object *stack_object; struct _k_object *stack_object;
/* The thread and stack objects *must* be in an uninitialized state */ /* The thread and stack objects *must* be in an uninitialized state */
@ -613,17 +613,17 @@ k_tid_t z_vrfy_k_thread_create(struct k_thread *new_thread,
/* Verify that the stack size passed in is OK by computing the total /* Verify that the stack size passed in is OK by computing the total
* size and comparing it with the size value in the object metadata * size and comparing it with the size value in the object metadata
*/ */
Z_OOPS(Z_SYSCALL_VERIFY_MSG(!u32_add_overflow(K_THREAD_STACK_RESERVED, Z_OOPS(Z_SYSCALL_VERIFY_MSG(!size_add_overflow(K_THREAD_STACK_RESERVED,
stack_size, &total_size), stack_size, &total_size),
"stack size overflow (%u+%u)", "stack size overflow (%zu+%zu)",
(unsigned int) stack_size, stack_size,
K_THREAD_STACK_RESERVED)); K_THREAD_STACK_RESERVED));
/* Testing less-than-or-equal since additional room may have been /* Testing less-than-or-equal since additional room may have been
* allocated for alignment constraints * allocated for alignment constraints
*/ */
Z_OOPS(Z_SYSCALL_VERIFY_MSG(total_size <= stack_object->data, Z_OOPS(Z_SYSCALL_VERIFY_MSG(total_size <= stack_object->data,
"stack size %u is too big, max is %lu", "stack size %zu is too big, max is %lu",
total_size, stack_object->data)); total_size, stack_object->data));
/* User threads may only create other user threads and they can't /* User threads may only create other user threads and they can't

View file

@ -1048,7 +1048,7 @@ void scenario_entry(void *stack_obj, size_t obj_size)
void test_stack_buffer(void) void test_stack_buffer(void)
{ {
printk("Reserved space: %u\n", K_THREAD_STACK_RESERVED); printk("Reserved space: %zu\n", K_THREAD_STACK_RESERVED);
printk("Provided stack size: %u\n", STEST_STACKSIZE); printk("Provided stack size: %u\n", STEST_STACKSIZE);
scenario_entry(stest_stack, sizeof(stest_stack)); scenario_entry(stest_stack, sizeof(stest_stack));