mirror of
https://github.com/Fishwaldo/linux-bl808.git
synced 2025-06-05 06:05:06 +00:00
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: Arend van Spriel <arend.vanspriel@broadcom.com> Signed-off-by: Franky Lin <franky.lin@broadcom.com> Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
This commit is contained in:
parent
21c5c83ce8
commit
d2af9b5665
1 changed files with 2 additions and 1 deletions
|
@ -40,7 +40,8 @@ int brcmf_debug_create_memdump(struct brcmf_bus *bus, const void *data,
|
|||
if (!dump)
|
||||
return -ENOMEM;
|
||||
|
||||
memcpy(dump, data, len);
|
||||
if (data && len > 0)
|
||||
memcpy(dump, data, len);
|
||||
err = brcmf_bus_get_memdump(bus, dump + len, ramsize);
|
||||
if (err) {
|
||||
vfree(dump);
|
||||
|
|
Loading…
Add table
Reference in a new issue