MPU Hal (#1492)
* Furi HAL: memory protection unit * Core: prohibit NULL dereferencing, even for reads. * Applications: fix NULL dereference * Core: stack protection by MPU * MPU: stack region alignment * Apps: fix null pointer dereferences * Threads: fix non-null arg check * Desktop settings: fix null pointer dereference * Core: documented null-check hack * Fix null dereference issues * Apps: args check * Core: naming fixes * format code * Core: remove NONNULL specifier * FurHal: move MPU initialization to begining, fix enum naming Co-authored-by: あく <alleteam@gmail.com>
This commit is contained in:
@@ -36,10 +36,8 @@ void* calloc(size_t count, size_t size) {
|
||||
}
|
||||
|
||||
char* strdup(const char* s) {
|
||||
const char* s_null = s;
|
||||
if(s_null == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
// arg s marked as non-null, so we need hack to check for NULL
|
||||
furi_check(((uint32_t)s << 2) != 0);
|
||||
|
||||
size_t siz = strlen(s) + 1;
|
||||
char* y = pvPortMalloc(siz);
|
||||
|
@@ -88,7 +88,7 @@ void furi_thread_set_name(FuriThread* thread, const char* name) {
|
||||
furi_assert(thread);
|
||||
furi_assert(thread->state == FuriThreadStateStopped);
|
||||
if(thread->name) free((void*)thread->name);
|
||||
thread->name = strdup(name);
|
||||
thread->name = name ? strdup(name) : NULL;
|
||||
}
|
||||
|
||||
void furi_thread_set_stack_size(FuriThread* thread, size_t stack_size) {
|
||||
|
Reference in New Issue
Block a user