aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Compostella <jeremy.compostella@intel.com>2016-05-02 17:29:28 +0200
committerBadhri Jagan Sridharan <Badhri@google.com>2016-08-10 13:24:12 -0700
commit26cab56d9af49e78dd1b395454f484003cc85575 (patch)
treeca91b646fbac1ffbab00b668589ffef18fdf3a2d
parent5a77db78398a7247ab6bb6ff9720bae19d1f9ff4 (diff)
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 <jeremy.compostella@intel.com>
-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 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';