[ubsan] switch external array declarations to a proper array
This fixes a ubsan warning where it thinks you are walking off the end of a symbol. No functional change.
This commit is contained in:
12
app/app.c
12
app/app.c
@@ -13,8 +13,8 @@
|
||||
#include <lk/console_cmd.h>
|
||||
#include <kernel/thread.h>
|
||||
|
||||
extern const struct app_descriptor __start_apps __WEAK;
|
||||
extern const struct app_descriptor __stop_apps __WEAK;
|
||||
extern const struct app_descriptor __start_apps[] __WEAK;
|
||||
extern const struct app_descriptor __stop_apps[] __WEAK;
|
||||
|
||||
static void start_app(const struct app_descriptor *app, bool detach);
|
||||
|
||||
@@ -23,13 +23,13 @@ void apps_init(void) {
|
||||
const struct app_descriptor *app;
|
||||
|
||||
/* call all the init routines */
|
||||
for (app = &__start_apps; app != &__stop_apps; app++) {
|
||||
for (app = __start_apps; app != __stop_apps; app++) {
|
||||
if (app->init)
|
||||
app->init(app);
|
||||
}
|
||||
|
||||
/* start any that want to start on boot */
|
||||
for (app = &__start_apps; app != &__stop_apps; app++) {
|
||||
for (app = __start_apps; app != __stop_apps; app++) {
|
||||
if (app->entry && (app->flags & APP_FLAG_NO_AUTOSTART) == 0) {
|
||||
start_app(app, true);
|
||||
}
|
||||
@@ -67,7 +67,7 @@ status_t app_start_by_name(const char *name, bool detached) {
|
||||
const struct app_descriptor *app;
|
||||
|
||||
/* find the app and call it */
|
||||
for (app = &__start_apps; app != &__stop_apps; app++) {
|
||||
for (app = __start_apps; app != __stop_apps; app++) {
|
||||
if (!strcmp(app->name, name)) {
|
||||
start_app(app, detached);
|
||||
return NO_ERROR;
|
||||
@@ -80,7 +80,7 @@ status_t app_start_by_name(const char *name, bool detached) {
|
||||
static void list_apps(void) {
|
||||
const struct app_descriptor *app;
|
||||
|
||||
for (app = &__start_apps; app != &__stop_apps; app++) {
|
||||
for (app = __start_apps; app != __stop_apps; app++) {
|
||||
printf("%s\n", app->name);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,13 +12,13 @@
|
||||
#include <lk/trace.h>
|
||||
|
||||
/* static list of devices constructed with DEVICE_INSTANCE macros */
|
||||
extern struct device __start_devices __WEAK;
|
||||
extern struct device __stop_devices __WEAK;
|
||||
extern struct device __start_devices[] __WEAK;
|
||||
extern struct device __stop_devices[] __WEAK;
|
||||
|
||||
status_t device_init_all(void) {
|
||||
status_t res = NO_ERROR;
|
||||
|
||||
for (struct device *dev = &__start_devices; dev != &__stop_devices; dev++) {
|
||||
for (struct device *dev = __start_devices; dev != __stop_devices; dev++) {
|
||||
if (dev->flags & DEVICE_FLAG_AUTOINIT) {
|
||||
status_t code = device_init(dev);
|
||||
|
||||
@@ -37,7 +37,7 @@ status_t device_init_all(void) {
|
||||
status_t device_fini_all(void) {
|
||||
status_t res = NO_ERROR;
|
||||
|
||||
for (struct device *dev = &__start_devices; dev != &__stop_devices; dev++) {
|
||||
for (struct device *dev = __start_devices; dev != __stop_devices; dev++) {
|
||||
status_t code = device_fini(dev);
|
||||
|
||||
if (code < 0) {
|
||||
|
||||
@@ -25,8 +25,8 @@
|
||||
#define EARLIEST_TRACE_LEVEL LK_INIT_LEVEL_TARGET_EARLY
|
||||
#endif
|
||||
|
||||
extern const struct lk_init_struct __start_lk_init __WEAK;
|
||||
extern const struct lk_init_struct __stop_lk_init __WEAK;
|
||||
extern const struct lk_init_struct __start_lk_init[] __WEAK;
|
||||
extern const struct lk_init_struct __stop_lk_init[] __WEAK;
|
||||
|
||||
void lk_init_level(enum lk_init_flags required_flag, uint16_t start_level, uint16_t stop_level) {
|
||||
LTRACEF("flags %#x, start_level %#hx, stop_level %#hx\n",
|
||||
@@ -41,7 +41,7 @@ void lk_init_level(enum lk_init_flags required_flag, uint16_t start_level, uint1
|
||||
|
||||
const struct lk_init_struct *found = NULL;
|
||||
bool seen_last = false;
|
||||
for (const struct lk_init_struct *ptr = &__start_lk_init; ptr != &__stop_lk_init; ptr++) {
|
||||
for (const struct lk_init_struct *ptr = __start_lk_init; ptr != __stop_lk_init; ptr++) {
|
||||
LTRACEF("looking at %p (%s) level %#x, flags %#x, seen_last %d\n", ptr, ptr->name, ptr->level, ptr->flags, seen_last);
|
||||
|
||||
if (ptr == last)
|
||||
|
||||
Reference in New Issue
Block a user