diff options
author | Alexey Khoroshilov <khoroshilov@ispras.ru> | 2014-12-12 16:43:55 -0500 |
---|---|---|
committer | Kalle Valo <kvalo@codeaurora.org> | 2014-12-24 10:26:08 -0500 |
commit | eae79b4f3e82ca63a53478a161b190a0d38fe526 (patch) | |
tree | 2883da0af086a51cddd82475a30bf5694b09cb2f | |
parent | 18e0c0bf3a5ea0f54384149570274d535341dc06 (diff) |
rsi: fix memory leak in rsi_load_ta_instructions()
Memory allocated by kmemdup() in rsi_load_ta_instructions() is leaked.
But duplication of firmware data here is useless,
so the patch removes kmemdup() at all.
Found by Linux Driver Verification project (linuxtesting.org).
Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
-rw-r--r-- | drivers/net/wireless/rsi/rsi_91x_sdio_ops.c | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/drivers/net/wireless/rsi/rsi_91x_sdio_ops.c b/drivers/net/wireless/rsi/rsi_91x_sdio_ops.c index 4834a9abc171..b6cc9ff47fc2 100644 --- a/drivers/net/wireless/rsi/rsi_91x_sdio_ops.c +++ b/drivers/net/wireless/rsi/rsi_91x_sdio_ops.c | |||
@@ -172,7 +172,6 @@ static int rsi_load_ta_instructions(struct rsi_common *common) | |||
172 | (struct rsi_91x_sdiodev *)adapter->rsi_dev; | 172 | (struct rsi_91x_sdiodev *)adapter->rsi_dev; |
173 | u32 len; | 173 | u32 len; |
174 | u32 num_blocks; | 174 | u32 num_blocks; |
175 | const u8 *fw; | ||
176 | const struct firmware *fw_entry = NULL; | 175 | const struct firmware *fw_entry = NULL; |
177 | u32 block_size = dev->tx_blk_size; | 176 | u32 block_size = dev->tx_blk_size; |
178 | int status = 0; | 177 | int status = 0; |
@@ -201,7 +200,6 @@ static int rsi_load_ta_instructions(struct rsi_common *common) | |||
201 | return status; | 200 | return status; |
202 | } | 201 | } |
203 | 202 | ||
204 | fw = kmemdup(fw_entry->data, fw_entry->size, GFP_KERNEL); | ||
205 | len = fw_entry->size; | 203 | len = fw_entry->size; |
206 | 204 | ||
207 | if (len % 4) | 205 | if (len % 4) |
@@ -212,7 +210,7 @@ static int rsi_load_ta_instructions(struct rsi_common *common) | |||
212 | rsi_dbg(INIT_ZONE, "%s: Instruction size:%d\n", __func__, len); | 210 | rsi_dbg(INIT_ZONE, "%s: Instruction size:%d\n", __func__, len); |
213 | rsi_dbg(INIT_ZONE, "%s: num blocks: %d\n", __func__, num_blocks); | 211 | rsi_dbg(INIT_ZONE, "%s: num blocks: %d\n", __func__, num_blocks); |
214 | 212 | ||
215 | status = rsi_copy_to_card(common, fw, len, num_blocks); | 213 | status = rsi_copy_to_card(common, fw_entry->data, len, num_blocks); |
216 | release_firmware(fw_entry); | 214 | release_firmware(fw_entry); |
217 | return status; | 215 | return status; |
218 | } | 216 | } |