Commit d2af9b56 authored by Franky Lin's avatar Franky Lin Committed by Kalle Valo

brcmfmac: validate user provided data for memdump before copying

In patch "brcmfmac: add support for sysfs initiated coredump", a new
scenario of brcmf_debug_create_memdump was added in which the user of
the function might not necessarily provide prefix data. Hence the
function should not assume the data is always valid and should perform a
check before copying.
Reviewed-by: default avatarArend van Spriel <arend.vanspriel@broadcom.com>
Signed-off-by: default avatarFranky Lin <franky.lin@broadcom.com>
Signed-off-by: default avatarArend van Spriel <arend.vanspriel@broadcom.com>
Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
parent 21c5c83c
...@@ -40,6 +40,7 @@ int brcmf_debug_create_memdump(struct brcmf_bus *bus, const void *data, ...@@ -40,6 +40,7 @@ int brcmf_debug_create_memdump(struct brcmf_bus *bus, const void *data,
if (!dump) if (!dump)
return -ENOMEM; return -ENOMEM;
if (data && len > 0)
memcpy(dump, data, len); memcpy(dump, data, len);
err = brcmf_bus_get_memdump(bus, dump + len, ramsize); err = brcmf_bus_get_memdump(bus, dump + len, ramsize);
if (err) { if (err) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment