Skip to content

Commit eae79b4

Browse files
khoroshilovKalle Valo
authored and
Kalle Valo
committed
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 <[email protected]> Signed-off-by: Kalle Valo <[email protected]>
1 parent 18e0c0b commit eae79b4

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

drivers/net/wireless/rsi/rsi_91x_sdio_ops.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,6 @@ static int rsi_load_ta_instructions(struct rsi_common *common)
172172
(struct rsi_91x_sdiodev *)adapter->rsi_dev;
173173
u32 len;
174174
u32 num_blocks;
175-
const u8 *fw;
176175
const struct firmware *fw_entry = NULL;
177176
u32 block_size = dev->tx_blk_size;
178177
int status = 0;
@@ -201,7 +200,6 @@ static int rsi_load_ta_instructions(struct rsi_common *common)
201200
return status;
202201
}
203202

204-
fw = kmemdup(fw_entry->data, fw_entry->size, GFP_KERNEL);
205203
len = fw_entry->size;
206204

207205
if (len % 4)
@@ -212,7 +210,7 @@ static int rsi_load_ta_instructions(struct rsi_common *common)
212210
rsi_dbg(INIT_ZONE, "%s: Instruction size:%d\n", __func__, len);
213211
rsi_dbg(INIT_ZONE, "%s: num blocks: %d\n", __func__, num_blocks);
214212

215-
status = rsi_copy_to_card(common, fw, len, num_blocks);
213+
status = rsi_copy_to_card(common, fw_entry->data, len, num_blocks);
216214
release_firmware(fw_entry);
217215
return status;
218216
}

0 commit comments

Comments
 (0)