OSDN Git Service

of: fix CONFIG_CMDLINE_EXTEND
authorColin Cross <ccross@android.com>
Thu, 7 Mar 2013 03:10:29 +0000 (19:10 -0800)
committerChih-Wei Huang <cwhuang@linux.org.tw>
Mon, 13 Apr 2015 16:43:05 +0000 (00:43 +0800)
commit4ae5a792c1ae905e051ec1f0388d88f38839bfb3
treeefdf9efef58bb070654b76c6cdb4e38e355e8a4f
parent735fc2cfec29d5cfdb734a4060a64c73305020a5
of: fix CONFIG_CMDLINE_EXTEND

strlcat takes the size of the buffer, not the number of characters
to concatenate.  If the size of the device tree command line p is
larger than the CONFIG_CMDLINE string data, then strcat(data, p, l)
will hit a BUG_ON because strlen(data) > l.

Replace the second strlcat with a strncpy plus a manual null
termination.

Also rearrange the code to reduce indent depth to make it more
readable, and replace data with a char *cmdline to avoid extra
casts.

Signed-off-by: Colin Cross <ccross@android.com>
drivers/of/fdt.c