ANDROID: dm: fix dm_substitute_devices()
authorJeremy Compostella <jeremy.compostella@intel.com>
Mon, 2 May 2016 15:29:28 +0000 (17:29 +0200)
committerAmit Pundir <amit.pundir@linaro.org>
Thu, 18 Aug 2016 13:26:03 +0000 (18:56 +0530)
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>
init/do_mounts_dm.c

index f521bc5ae248416610da0a093313849bf226b8fa..ecda58df9a19edf16d8d25890fb57a1a12ded908 100644 (file)
@@ -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';