block/partitions/rk: fix panic when cmdline without mtdparts
authorHuang, Tao <huangtao@rock-chips.com>
Tue, 1 Dec 2015 12:15:01 +0000 (20:15 +0800)
committerHuang, Tao <huangtao@rock-chips.com>
Tue, 1 Dec 2015 12:19:43 +0000 (20:19 +0800)
Change-Id: I1a3b052ac671ce4abddaf941373f38c11193f0d4
Signed-off-by: Huang, Tao <huangtao@rock-chips.com>
block/partitions/rk.c

index 0a20ababa44ba2683193df78740bdaf774a02c21..76f72002134ceab9e5731e15f9c3b0d34f510fa4 100755 (executable)
@@ -305,7 +305,10 @@ int rkpart_partition(struct parsed_partitions *state)
                 return 0;
 
         /* Fixme: parameter should be coherence with part table */
-       cmdline = strstr(saved_command_line, "mtdparts=") + 9;
+       cmdline = strstr(saved_command_line, "mtdparts=");
+       if (!cmdline)
+               return 0;
+       cmdline += 9;
        cmdline_parsed = 0;
 
        num_parts = parse_cmdline_partitions(n, &parts, 0);