Commit 2441fa93 authored by Michael Straube's avatar Michael Straube Committed by Greg Kroah-Hartman

staging: r8188eu: use kmemdup instead of kzalloc and memcpy

Use kmemdup instead of kzalloc and memcpy in load_firmware().
Signed-off-by: default avatarMichael Straube <straube.linux@gmail.com>
Link: https://lore.kernel.org/r/20220107103620.15648-10-straube.linux@gmail.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 2f8e84b2
......@@ -525,18 +525,13 @@ static int load_firmware(struct rt_firmware *rtfw, struct device *device)
ret = _FAIL;
goto exit;
}
if (fw->size > FW_8188E_SIZE) {
ret = _FAIL;
goto exit;
}
rtfw->data = kzalloc(FW_8188E_SIZE, GFP_KERNEL);
rtfw->data = kmemdup(fw->data, fw->size, GFP_KERNEL);
if (!rtfw->data) {
pr_err("Failed to allocate rtfw->data\n");
ret = _FAIL;
goto exit;
}
memcpy(rtfw->data, fw->data, fw->size);
rtfw->size = fw->size;
dev_dbg(device, "!bUsedWoWLANFw, FmrmwareLen:%d+\n", rtfw->size);
......
......@@ -35,7 +35,6 @@
#define PageNum_128(_Len) (u32)(((_Len)>>7) + ((_Len) & 0x7F ? 1 : 0))
/* download firmware related data structure */
#define FW_8188E_SIZE 0x4000 /* 16384,16k */
#define FW_8188E_START_ADDRESS 0x1000
#define MAX_PAGE_SIZE 4096 /* @ page : 4k bytes */
......
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