From 8615e2c8e5a0964b871282582127e4a6aad763a5 Mon Sep 17 00:00:00 2001 From: Grissiom Date: Tue, 14 Oct 2014 16:00:42 +0800 Subject: kernel/timer: change row_lvl to unsigned Use signed int as array index is unsecure. --- src/timer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/timer.c b/src/timer.c index f71e40fcd6..ba2801530d 100644 --- a/src/timer.c +++ b/src/timer.c @@ -293,7 +293,7 @@ RTM_EXPORT(rt_timer_delete); */ rt_err_t rt_timer_start(rt_timer_t timer) { - int row_lvl; + unsigned int row_lvl; rt_list_t *timer_list; register rt_base_t level; rt_list_t *row_head[RT_TIMER_SKIP_LIST_LEVEL]; -- cgit v1.3.1 From 4bb6c8cf0c6f4ac73c835b118eb7166264e1a842 Mon Sep 17 00:00:00 2001 From: Grissiom Date: Mon, 1 Dec 2014 18:54:55 +0800 Subject: module: add !__CC_ARM when test __GNUC__ ARMCC will define __GNUC__ in "GNU mode"(with --gnu command line option). So iff __GNUC__ && !__CC_ARM is GCC. --- src/module.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/module.c b/src/module.c index 5d5d02c580..1c20de731d 100644 --- a/src/module.c +++ b/src/module.c @@ -82,7 +82,7 @@ static struct rt_module_symtab *_rt_module_symtab_end = RT_NULL; */ int rt_system_module_init(void) { -#ifdef __GNUC__ +#if defined(__GNUC__) && !defined(__CC_ARM) extern int __rtmsymtab_start; extern int __rtmsymtab_end; -- cgit v1.3.1 From c045281ee2991c9324747b8731d34ba314573fa8 Mon Sep 17 00:00:00 2001 From: Grissiom Date: Tue, 16 Dec 2014 12:05:53 +0800 Subject: object: fix module name testing --- src/object.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/object.c b/src/object.c index 32dc0f2384..6c5a1a026f 100644 --- a/src/object.c +++ b/src/object.c @@ -417,7 +417,7 @@ rt_object_t rt_object_find(const char *name, rt_uint8_t type) { const char *name_ptr; int module_name_length; - + name_ptr = name; while ((*name_ptr != '\0') && (*name_ptr != '/')) name_ptr ++; @@ -434,13 +434,13 @@ rt_object_t rt_object_find(const char *name, rt_uint8_t type) /* find module */ information = &rt_object_container[RT_Object_Class_Module]; - for (node = information->object_list.next; + for (node = information->object_list.next; node != &(information->object_list); node = node->next) { object = rt_list_entry(node, struct rt_object, list); if ((rt_strncmp(object->name, name, module_name_length) == 0) && - module_name_length == RT_NAME_MAX || object->name[module_name_length] == '\0') + (module_name_length == RT_NAME_MAX || object->name[module_name_length] == '\0')) { /* get module */ module = (struct rt_module*)object; @@ -450,7 +450,7 @@ rt_object_t rt_object_find(const char *name, rt_uint8_t type) rt_exit_critical(); /* there is no this module inside the system */ - if (module == RT_NULL) return RT_NULL; + if (module == RT_NULL) return RT_NULL; /* get the object pool of module */ information = &(module->module_object[type]); -- cgit v1.3.1 From 57b5c74a71a48bbd55826cff5f709a2f028fc4d7 Mon Sep 17 00:00:00 2001 From: Grissiom Date: Sun, 4 Jan 2015 19:43:33 +0800 Subject: rt_kprintf: force the open_flag to be RT_DEVICE_FLAG_STREAM Commit a6251a439e7385f changed the serial device to check open_flag instead of flag. So we should change the rt_kprintf counterpart as well. --- src/kservice.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/kservice.c b/src/kservice.c index 12878e67d1..fef284e8af 100644 --- a/src/kservice.c +++ b/src/kservice.c @@ -1114,11 +1114,11 @@ void rt_kprintf(const char *fmt, ...) } else { - rt_uint16_t old_flag = _console_device->flag; + rt_uint16_t old_flag = _console_device->open_flag; - _console_device->flag |= RT_DEVICE_FLAG_STREAM; + _console_device->open_flag |= RT_DEVICE_FLAG_STREAM; rt_device_write(_console_device, 0, rt_log_buf, length); - _console_device->flag = old_flag; + _console_device->open_flag = old_flag; } #else rt_hw_console_output(rt_log_buf); -- cgit v1.3.1 From f8c171d5ad752045a243e846718585ec1c671771 Mon Sep 17 00:00:00 2001 From: Grissiom Date: Fri, 16 Jan 2015 11:41:20 +0800 Subject: memheap: check against over written in rt_memheap_free --- src/memheap.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src') diff --git a/src/memheap.c b/src/memheap.c index e19c83a08c..adb5c86053 100644 --- a/src/memheap.c +++ b/src/memheap.c @@ -517,6 +517,8 @@ void rt_memheap_free(void *ptr) /* check magic */ RT_ASSERT((header_ptr->magic & RT_MEMHEAP_MASK) == RT_MEMHEAP_MAGIC); + /* check whether this block of memory has been over-written. */ + RT_ASSERT((header_ptr->next->magic & RT_MEMHEAP_MASK) == RT_MEMHEAP_MAGIC); /* get pool ptr */ heap = header_ptr->pool_ptr; -- cgit v1.3.1 From b83b1ee53dd053487a38472bd946a8d66fe3f472 Mon Sep 17 00:00:00 2001 From: Bernard Xiong Date: Wed, 21 Jan 2015 14:19:01 +0800 Subject: [Kernel] Change the copyright date information --- src/kservice.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/kservice.c b/src/kservice.c index fef284e8af..b5dc92b091 100644 --- a/src/kservice.c +++ b/src/kservice.c @@ -513,7 +513,7 @@ void rt_show_version(void) rt_kprintf("- RT - Thread Operating System\n"); rt_kprintf(" / | \\ %d.%d.%d build %s\n", RT_VERSION, RT_SUBVERSION, RT_REVISION, __DATE__); - rt_kprintf(" 2006 - 2013 Copyright by rt-thread team\n"); + rt_kprintf(" 2006 - 2015 Copyright by rt-thread team\n"); } RTM_EXPORT(rt_show_version); -- cgit v1.3.1