diff options
author | Thomas Bogendoerfer <tsbogend@alpha.franken.de> | 2020-03-30 13:31:37 +0200 |
---|---|---|
committer | Thomas Bogendoerfer <tsbogend@alpha.franken.de> | 2020-03-30 13:31:37 +0200 |
commit | ba15533275dd70238b523417d222d43fb40dac9d (patch) | |
tree | e97f6b804994d20ce476dc5a123fc074799e9584 /init/main.c | |
parent | f75410a406e934e4cf31e0a7ec151799a6bf38cf (diff) | |
parent | 7111951b8d4973bda27ff663f2cf18b663d15b48 (diff) | |
download | linux-ba15533275dd70238b523417d222d43fb40dac9d.tar.gz linux-ba15533275dd70238b523417d222d43fb40dac9d.tar.bz2 linux-ba15533275dd70238b523417d222d43fb40dac9d.zip |
Merge tag 'v5.6' into mips-next
Linux 5.6
Diffstat (limited to 'init/main.c')
-rw-r--r-- | init/main.c | 38 |
1 files changed, 22 insertions, 16 deletions
diff --git a/init/main.c b/init/main.c index f95b014a5479..ee4947af823f 100644 --- a/init/main.c +++ b/init/main.c @@ -268,7 +268,6 @@ static int __init xbc_snprint_cmdline(char *buf, size_t size, { struct xbc_node *knode, *vnode; char *end = buf + size; - char c = '\"'; const char *val; int ret; @@ -279,25 +278,20 @@ static int __init xbc_snprint_cmdline(char *buf, size_t size, return ret; vnode = xbc_node_get_child(knode); - ret = snprintf(buf, rest(buf, end), "%s%c", xbc_namebuf, - vnode ? '=' : ' '); - if (ret < 0) - return ret; - buf += ret; - if (!vnode) + if (!vnode) { + ret = snprintf(buf, rest(buf, end), "%s ", xbc_namebuf); + if (ret < 0) + return ret; + buf += ret; continue; - - c = '\"'; + } xbc_array_for_each_value(vnode, val) { - ret = snprintf(buf, rest(buf, end), "%c%s", c, val); + ret = snprintf(buf, rest(buf, end), "%s=\"%s\" ", + xbc_namebuf, val); if (ret < 0) return ret; buf += ret; - c = ','; } - if (rest(buf, end) > 2) - strcpy(buf, "\" "); - buf += 2; } return buf - (end - size); @@ -335,7 +329,7 @@ static char * __init xbc_make_cmdline(const char *key) return new_cmdline; } -u32 boot_config_checksum(unsigned char *p, u32 size) +static u32 boot_config_checksum(unsigned char *p, u32 size) { u32 ret = 0; @@ -374,7 +368,11 @@ static void __init setup_boot_config(const char *cmdline) if (!initrd_end) goto not_found; - hdr = (u32 *)(initrd_end - 8); + data = (char *)initrd_end - BOOTCONFIG_MAGIC_LEN; + if (memcmp(data, BOOTCONFIG_MAGIC, BOOTCONFIG_MAGIC_LEN)) + goto not_found; + + hdr = (u32 *)(data - 8); size = hdr[0]; csum = hdr[1]; @@ -418,6 +416,14 @@ not_found: } #else #define setup_boot_config(cmdline) do { } while (0) + +static int __init warn_bootconfig(char *str) +{ + pr_warn("WARNING: 'bootconfig' found on the kernel command line but CONFIG_BOOTCONFIG is not set.\n"); + return 0; +} +early_param("bootconfig", warn_bootconfig); + #endif /* Change NUL term back to "=", to make "param" the whole string. */ |