aboutsummaryrefslogtreecommitdiff
path: root/drivers/dfu/dfu_ram.c
diff options
context:
space:
mode:
authorMasami Hiramatsu <masami.hiramatsu@linaro.org>2022-01-31 11:52:29 +0900
committerTom Rini <trini@konsulko.com>2022-02-11 11:29:23 -0500
commit8db74c153b4e30edc5290da6c7330c63558678d0 (patch)
treee98f5ce256899d325e30abf32939a0d5ac8cc72c /drivers/dfu/dfu_ram.c
parentd8ae90a8d47da2f22041bf9f6fd6d42a598f44ee (diff)
downloadu-boot-8db74c153b4e30edc5290da6c7330c63558678d0.zip
u-boot-8db74c153b4e30edc5290da6c7330c63558678d0.tar.gz
u-boot-8db74c153b4e30edc5290da6c7330c63558678d0.tar.bz2
DFU: Accept redundant spaces and tabs in dfu_alt_info
If dfu_alt_info has repeated spaces or tab (for indentation or readability), the dfu fails to parse it. For example, if dfu_alt_info="mtd nor1=image raw 100000 200000" (double spaces after "raw"), the image entity start address is '0' and the size '0x100000'. This is because the repeated space is not skipped. Use space and tab as a separater and apply skip_spaces() to skip redundant spaces and tabs. Signed-off-by: Masami Hiramatsu <masami.hiramatsu@linaro.org>
Diffstat (limited to 'drivers/dfu/dfu_ram.c')
-rw-r--r--drivers/dfu/dfu_ram.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/dfu/dfu_ram.c b/drivers/dfu/dfu_ram.c
index cc7e45b..361a3ff 100644
--- a/drivers/dfu/dfu_ram.c
+++ b/drivers/dfu/dfu_ram.c
@@ -60,11 +60,12 @@ int dfu_fill_entity_ram(struct dfu_entity *dfu, char *devstr, char *s)
const char **parg = argv;
for (; parg < argv + sizeof(argv) / sizeof(*argv); ++parg) {
- *parg = strsep(&s, " ");
+ *parg = strsep(&s, " \t");
if (*parg == NULL) {
pr_err("Invalid number of arguments.\n");
return -ENODEV;
}
+ s = skip_spaces(s);
}
dfu->dev_type = DFU_DEV_RAM;