OSDN Git Service

ANDROID: of: fix CONFIG_CMDLINE_EXTEND
authorColin Cross <ccross@android.com>
Thu, 7 Mar 2013 03:10:29 +0000 (19:10 -0800)
committerDmitry Shmidt <dimitrysh@google.com>
Fri, 27 Jan 2017 21:52:17 +0000 (13:52 -0800)
commite820270abb5d0a75072c719279597db621b3dce6
tree3cebfc0c143067fb0b4fbf4aeff97a1cd9f2e879
parent8e56764990dfa9b76e3c5193bab0ee9cd0fe5ec9
ANDROID: 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