summaryrefslogtreecommitdiff
authorJeremy Compostella <jeremy.compostella@intel.com>2016-05-02 15:29:28 (GMT)
committer Dmitry Shmidt <dimitrysh@google.com>2017-01-27 21:55:16 (GMT)
commitba2055cde18724292cc8013dd1e7db199b59771d (patch)
tree17212d9ee498281d0938c1397daaf8f177b858a5
parentae8b49031118932b376426907e5245c18e06112b (diff)
downloadcommon-ba2055cde18724292cc8013dd1e7db199b59771d.zip
common-ba2055cde18724292cc8013dd1e7db199b59771d.tar.gz
common-ba2055cde18724292cc8013dd1e7db199b59771d.tar.bz2
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>
Diffstat
-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 0fe9c5f..a557c5e 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';