summaryrefslogtreecommitdiff
path: root/init
diff options
context:
space:
mode:
authorJeremy Compostella <jeremy.compostella@intel.com>2016-05-02 17:29:28 +0200
committerAmit Pundir <amit.pundir@linaro.org>2017-12-18 21:11:22 +0530
commit052d02c07cbe70ddbd6da4b001c220d7e597286a (patch)
tree73605660cb3be0e4d20098ad100e07b6d03fe6d2 /init
parent398884b9e1d8208ac8bb89ec8eaa23e84b4cbda9 (diff)
ANDROID: dm: do_mounts_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 <jeremy.compostella@intel.com>
Diffstat (limited to 'init')
-rw-r--r--init/do_mounts_dm.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/init/do_mounts_dm.c b/init/do_mounts_dm.c
index 0fe9c5f7d5e9..a557c5ee00a7 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';