Merge "board: bootqca: add null check for bootargs"

This commit is contained in:
Linux Build Service Account 2024-03-18 05:43:09 -07:00 committed by Gerrit - the friendly Code Review server
commit 4568deeb3c

View file

@ -130,17 +130,23 @@ static int update_bootargs(void *addr)
memset(cmd_line, 0, CONFIG_SYS_CBSIZE);
fit_bootargs = (char *)fdt_getprop(addr, 0, FIT_BOOTARGS_PROP, &len);
if ((fit_bootargs != NULL) && len) {
if ((strlen(strings) + len) > CONFIG_SYS_CBSIZE) {
if (strings && ((strlen(strings) + len) > CONFIG_SYS_CBSIZE)) {
ret = CMD_RET_FAILURE;
} else {
memcpy(cmd_line, strings, strlen(strings));
snprintf(cmd_line + strlen(strings), CONFIG_SYS_CBSIZE,
if(strings)
memcpy(cmd_line, strings, strlen(strings));
snprintf(cmd_line + (strings? strlen(strings) : 0),
CONFIG_SYS_CBSIZE,
" %s rootwait", fit_bootargs);
}
} else {
memcpy(cmd_line, strings, strlen(strings));
len = snprintf(cmd_line + strlen(strings), CONFIG_SYS_CBSIZE,
" %s rootwait", getenv("fsbootargs"));
if(strings)
memcpy(cmd_line, strings, strlen(strings));
len = snprintf(cmd_line + (strings? strlen(strings) : 0),
CONFIG_SYS_CBSIZE,
" %s rootwait", getenv("fsbootargs"));
if (len >= CONFIG_SYS_CBSIZE)
ret = CMD_RET_FAILURE;
}