Skip to content

Commit

Permalink
wifi: mt76: mt7915: fix mt7915_rate_txpower_get() resource leaks
Browse files Browse the repository at this point in the history
Coverity message: variable "buf" going out of scope leaks the storage.

Reported-by: coverity-bot <keescook+coverity-bot@chromium.org>
Addresses-Coverity-ID: 1527799 ("Resource leaks")
Fixes: e3296759f347 ("wifi: mt76: mt7915: enable per bandwidth power limit support")
Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
  • Loading branch information
ryderlee1110 authored and nbd168 committed Dec 10, 2022
1 parent f91d6f3 commit 1ce4970
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion mt7915/debugfs.c
Expand Up @@ -996,7 +996,7 @@ mt7915_rate_txpower_get(struct file *file, char __user *user_buf,

ret = mt7915_mcu_get_txpower_sku(phy, txpwr, sizeof(txpwr));
if (ret)
return ret;
goto out;

/* Txpower propagation path: TMAC -> TXV -> BBP */
len += scnprintf(buf + len, sz - len,
Expand Down Expand Up @@ -1047,6 +1047,8 @@ mt7915_rate_txpower_get(struct file *file, char __user *user_buf,
mt76_get_field(dev, reg, MT_WF_PHY_TPC_POWER));

ret = simple_read_from_buffer(user_buf, count, ppos, buf, len);

out:
kfree(buf);
return ret;
}
Expand Down

0 comments on commit 1ce4970

Please sign in to comment.