From: Jeremy Compostella Date: Mon, 2 May 2016 15:29:28 +0000 (+0200) Subject: ANDROID: dm: fix dm_substitute_devices() X-Git-Tag: firefly_0821_release~176^2~352 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=b8681ffa6859d3f267d625d4770987df5832a42b;p=firefly-linux-kernel-4.4.55.git ANDROID: dm: fix dm_substitute_devices() When candidate is the last parameter, candidate_end points to the '\0' character and not the DM_FIELD_SEP character. In such a situation, we should not move the candidate_end pointer one character backward. Signed-off-by: Jeremy Compostella --- diff --git a/init/do_mounts_dm.c b/init/do_mounts_dm.c index f521bc5ae248..ecda58df9a19 100644 --- a/init/do_mounts_dm.c +++ b/init/do_mounts_dm.c @@ -176,7 +176,8 @@ static void __init dm_substitute_devices(char *str, size_t str_len) continue; /* Temporarily terminate with a nul */ - candidate_end--; + if (*candidate_end) + candidate_end--; old_char = *candidate_end; *candidate_end = '\0';